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