You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
6.8 KiB

  1. --- a/drivers/head/stub_dev.c
  2. +++ b/drivers/head/stub_dev.c
  3. @@ -398,7 +398,11 @@ static int stub_probe(struct usb_interfa
  4. {
  5. struct usb_device *udev = interface_to_usbdev(interface);
  6. struct stub_device *sdev = NULL;
  7. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
  8. char *udev_busid = interface->dev.parent->bus_id;
  9. +#else
  10. + char *udev_busid = dev_name(interface->dev.parent);
  11. +#endif
  12. int err = 0;
  13. udbg("Enter\n");
  14. --- a/drivers/head/stub_main.c
  15. +++ b/drivers/head/stub_main.c
  16. @@ -252,18 +252,17 @@ static int __init usb_stub_init(void)
  17. return -ENOMEM;
  18. }
  19. + info(DRIVER_DESC "" DRIVER_VERSION);
  20. +
  21. + memset(busid_table, 0, sizeof(busid_table));
  22. + spin_lock_init(&busid_table_lock);
  23. +
  24. ret = usb_register(&stub_driver);
  25. if (ret) {
  26. uerr("usb_register failed %d\n", ret);
  27. return ret;
  28. }
  29. -
  30. - info(DRIVER_DESC "" DRIVER_VERSION);
  31. -
  32. - memset(busid_table, 0, sizeof(busid_table));
  33. - spin_lock_init(&busid_table_lock);
  34. -
  35. ret = driver_create_file(&stub_driver.drvwrap.driver, &driver_attr_match_busid);
  36. if (ret) {
  37. --- a/drivers/head/stub_rx.c
  38. +++ b/drivers/head/stub_rx.c
  39. @@ -159,7 +159,11 @@ static int tweak_set_configuration_cmd(s
  40. * A user may need to set a special configuration value before
  41. * exporting the device.
  42. */
  43. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
  44. uinfo("set_configuration (%d) to %s\n", config, urb->dev->dev.bus_id);
  45. +#else
  46. + uinfo("set_configuration (%d) to %s\n", config, dev_name(&urb->dev->dev));
  47. +#endif
  48. uinfo("but, skip!\n");
  49. return 0;
  50. @@ -177,7 +181,11 @@ static int tweak_reset_device_cmd(struct
  51. value = le16_to_cpu(req->wValue);
  52. index = le16_to_cpu(req->wIndex);
  53. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
  54. uinfo("reset_device (port %d) to %s\n", index, urb->dev->dev.bus_id);
  55. +#else
  56. + uinfo("reset_device (port %d) to %s\n", index, dev_name(&urb->dev->dev));
  57. +#endif
  58. /* all interfaces should be owned by usbip driver, so just reset it. */
  59. ret = usb_lock_device_for_reset(urb->dev, NULL);
  60. @@ -187,7 +195,11 @@ static int tweak_reset_device_cmd(struct
  61. }
  62. /* try to reset the device */
  63. - ret = usb_reset_composite_device(urb->dev, NULL);
  64. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
  65. + ret = usb_reset_composite_device(urb->dev, NULL);
  66. +#else
  67. + ret = usb_reset_device(urb->dev);
  68. +#endif
  69. if (ret < 0)
  70. uerr("device reset\n");
  71. --- a/drivers/head/usbip_common.c
  72. +++ b/drivers/head/usbip_common.c
  73. @@ -55,10 +55,7 @@ static ssize_t show_flag(struct device *
  74. static ssize_t store_flag(struct device *dev, struct device_attribute *attr,
  75. const char *buf, size_t count)
  76. {
  77. - unsigned long flag;
  78. -
  79. - sscanf(buf, "%lx", &flag);
  80. - usbip_debug_flag = flag;
  81. + sscanf(buf, "%lx", &usbip_debug_flag);
  82. return count;
  83. }
  84. @@ -390,7 +387,7 @@ int usbip_thread(void *param)
  85. unlock_kernel();
  86. /* srv.rb must wait for rx_thread starting */
  87. - complete(&ut->thread_done);
  88. + complete(&ut->thread_started);
  89. /* start of while loop */
  90. ut->loop_ops(ut);
  91. @@ -403,15 +400,21 @@ int usbip_thread(void *param)
  92. void usbip_start_threads(struct usbip_device *ud)
  93. {
  94. +
  95. /*
  96. * threads are invoked per one device (per one connection).
  97. */
  98. + INIT_COMPLETION(ud->tcp_rx.thread_started);
  99. + INIT_COMPLETION(ud->tcp_tx.thread_started);
  100. + INIT_COMPLETION(ud->tcp_rx.thread_done);
  101. + INIT_COMPLETION(ud->tcp_tx.thread_done);
  102. +
  103. kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_rx, 0);
  104. kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_tx, 0);
  105. /* confirm threads are starting */
  106. - wait_for_completion(&ud->tcp_rx.thread_done);
  107. - wait_for_completion(&ud->tcp_tx.thread_done);
  108. + wait_for_completion(&ud->tcp_rx.thread_started);
  109. + wait_for_completion(&ud->tcp_tx.thread_started);
  110. }
  111. EXPORT_SYMBOL(usbip_start_threads);
  112. @@ -436,6 +439,7 @@ void usbip_task_init(struct usbip_task *
  113. void (*loop_ops)(struct usbip_task *))
  114. {
  115. ut->thread = NULL;
  116. + init_completion(&ut->thread_started);
  117. init_completion(&ut->thread_done);
  118. ut->name = name;
  119. ut->loop_ops = loop_ops;
  120. --- a/drivers/head/usbip_event.c
  121. +++ b/drivers/head/usbip_event.c
  122. @@ -38,7 +38,7 @@ void usbip_start_eh(struct usbip_device
  123. kernel_thread((int(*)(void *)) usbip_thread, (void *) eh, 0);
  124. - wait_for_completion(&eh->thread_done);
  125. + wait_for_completion(&eh->thread_started);
  126. }
  127. EXPORT_SYMBOL(usbip_start_eh);
  128. --- a/drivers/head/vhci_hcd.c
  129. +++ b/drivers/head/vhci_hcd.c
  130. @@ -58,7 +58,7 @@ static void vhci_stop(struct usb_hcd *hc
  131. static int vhci_get_frame_number(struct usb_hcd *hcd);
  132. static const char driver_name[] = "vhci_hcd";
  133. -static const char driver_desc[] = "USB/IP Virtual Host Contoroller";
  134. +static const char driver_desc[] = "USB/IP Virtual Host Controller";
  135. @@ -416,14 +416,6 @@ static int vhci_hub_control(struct usb_h
  136. case USB_PORT_FEAT_SUSPEND:
  137. dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_SUSPEND\n");
  138. uerr(" not yet\n");
  139. -#if 0
  140. - dum->port_status[rhport] |= (1 << USB_PORT_FEAT_SUSPEND);
  141. - if (dum->driver->suspend) {
  142. - spin_unlock (&dum->lock);
  143. - dum->driver->suspend (&dum->gadget);
  144. - spin_lock (&dum->lock);
  145. - }
  146. -#endif
  147. break;
  148. case USB_PORT_FEAT_RESET:
  149. dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_RESET\n");
  150. @@ -432,12 +424,6 @@ static int vhci_hub_control(struct usb_h
  151. dum->port_status[rhport] &= ~(USB_PORT_STAT_ENABLE
  152. | USB_PORT_STAT_LOW_SPEED
  153. | USB_PORT_STAT_HIGH_SPEED);
  154. -#if 0
  155. - if (dum->driver) {
  156. - dev_dbg (hardware, "disconnect\n");
  157. - stop_activity (dum, dum->driver);
  158. - }
  159. -#endif
  160. /* FIXME test that code path! */
  161. }
  162. @@ -1060,7 +1046,7 @@ static int vhci_hcd_probe(struct platfor
  163. struct usb_hcd *hcd;
  164. int ret;
  165. - uinfo("proving...\n");
  166. + uinfo("probing...\n");
  167. dbg_vhci_hc("name %s id %d\n", pdev->name, pdev->id);
  168. @@ -1076,7 +1062,11 @@ static int vhci_hcd_probe(struct platfor
  169. * Allocate and initialize hcd.
  170. * Our private data is also allocated automatically.
  171. */
  172. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
  173. hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, pdev->dev.bus_id);
  174. +#else
  175. + hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, dev_name(&pdev->dev));
  176. +#endif
  177. if (!hcd) {
  178. uerr("create hcd failed\n");
  179. return -ENOMEM;
  180. --- a/drivers/head/vhci_sysfs.c
  181. +++ b/drivers/head/vhci_sysfs.c
  182. @@ -123,7 +123,11 @@ static ssize_t show_status(struct device
  183. out += sprintf(out, "%03u %08x ",
  184. vdev->speed, vdev->devid);
  185. out += sprintf(out, "%16p ", vdev->ud.tcp_socket);
  186. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
  187. out += sprintf(out, "%s", vdev->udev->dev.bus_id);
  188. +#else
  189. + out += sprintf(out, "%s", dev_name(&vdev->udev->dev));
  190. +#endif
  191. } else
  192. out += sprintf(out, "000 000 000 0000000000000000 0-0");
  193. --- a/drivers/head/usbip_common.h
  194. +++ b/drivers/head/usbip_common.h
  195. @@ -300,6 +300,7 @@ struct usbip_device;
  196. struct usbip_task {
  197. struct task_struct *thread;
  198. + struct completion thread_started;
  199. struct completion thread_done;
  200. char *name;
  201. void (*loop_ops)(struct usbip_task *);