net/usbip: add some upstream patches (sync to svn #152, may deal with issues of ...
[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 @@ -27,7 +27,7 @@
83 #include "usbip_common.h"
84
85 /* version information */
86 -#define DRIVER_VERSION "$Id: usbip_common.c 66 2008-04-20 13:19:42Z hirofuchi $"
87 +#define DRIVER_VERSION "$Id$"
88 #define DRIVER_AUTHOR "Takahiro Hirofuchi <hirofuchi _at_ users.sourceforge.net>"
89 #define DRIVER_DESC "usbip common driver"
90
91 @@ -55,10 +55,7 @@ static ssize_t show_flag(struct device *
92 static ssize_t store_flag(struct device *dev, struct device_attribute *attr,
93 const char *buf, size_t count)
94 {
95 - unsigned long flag;
96 -
97 - sscanf(buf, "%lx", &flag);
98 - usbip_debug_flag = flag;
99 + sscanf(buf, "%lx", &usbip_debug_flag);
100
101 return count;
102 }
103 @@ -390,7 +387,7 @@ int usbip_thread(void *param)
104 unlock_kernel();
105
106 /* srv.rb must wait for rx_thread starting */
107 - complete(&ut->thread_done);
108 + complete(&ut->thread_started);
109
110 /* start of while loop */
111 ut->loop_ops(ut);
112 @@ -403,15 +400,21 @@ int usbip_thread(void *param)
113
114 void usbip_start_threads(struct usbip_device *ud)
115 {
116 +
117 /*
118 * threads are invoked per one device (per one connection).
119 */
120 + INIT_COMPLETION(ud->tcp_rx.thread_started);
121 + INIT_COMPLETION(ud->tcp_tx.thread_started);
122 + INIT_COMPLETION(ud->tcp_rx.thread_done);
123 + INIT_COMPLETION(ud->tcp_tx.thread_done);
124 +
125 kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_rx, 0);
126 kernel_thread((int(*)(void *))usbip_thread, (void *)&ud->tcp_tx, 0);
127
128 /* confirm threads are starting */
129 - wait_for_completion(&ud->tcp_rx.thread_done);
130 - wait_for_completion(&ud->tcp_tx.thread_done);
131 + wait_for_completion(&ud->tcp_rx.thread_started);
132 + wait_for_completion(&ud->tcp_tx.thread_started);
133 }
134 EXPORT_SYMBOL(usbip_start_threads);
135
136 @@ -436,6 +439,7 @@ void usbip_task_init(struct usbip_task *
137 void (*loop_ops)(struct usbip_task *))
138 {
139 ut->thread = NULL;
140 + init_completion(&ut->thread_started);
141 init_completion(&ut->thread_done);
142 ut->name = name;
143 ut->loop_ops = loop_ops;
144 --- a/drivers/head/usbip_event.c
145 +++ b/drivers/head/usbip_event.c
146 @@ -38,7 +38,7 @@ void usbip_start_eh(struct usbip_device
147
148 kernel_thread((int(*)(void *)) usbip_thread, (void *) eh, 0);
149
150 - wait_for_completion(&eh->thread_done);
151 + wait_for_completion(&eh->thread_started);
152 }
153 EXPORT_SYMBOL(usbip_start_eh);
154
155 --- a/drivers/head/vhci_hcd.c
156 +++ b/drivers/head/vhci_hcd.c
157 @@ -24,7 +24,7 @@
158 #include "usbip_common.h"
159 #include "vhci.h"
160
161 -#define DRIVER_VERSION " $Id: vhci_hcd.c 66 2008-04-20 13:19:42Z hirofuchi $ "
162 +#define DRIVER_VERSION " $Id$ "
163 #define DRIVER_AUTHOR "Takahiro Hirofuchi"
164 #define DRIVER_DESC "Virtual Host Controller Interface Driver for USB/IP"
165 #define DRIVER_LICENCE "GPL"
166 @@ -58,7 +58,7 @@ static void vhci_stop(struct usb_hcd *hc
167 static int vhci_get_frame_number(struct usb_hcd *hcd);
168
169 static const char driver_name[] = "vhci_hcd";
170 -static const char driver_desc[] = "USB/IP Virtual Host Contoroller";
171 +static const char driver_desc[] = "USB/IP Virtual Host Controller";
172
173
174
175 @@ -416,14 +416,6 @@ static int vhci_hub_control(struct usb_h
176 case USB_PORT_FEAT_SUSPEND:
177 dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_SUSPEND\n");
178 uerr(" not yet\n");
179 -#if 0
180 - dum->port_status[rhport] |= (1 << USB_PORT_FEAT_SUSPEND);
181 - if (dum->driver->suspend) {
182 - spin_unlock (&dum->lock);
183 - dum->driver->suspend (&dum->gadget);
184 - spin_lock (&dum->lock);
185 - }
186 -#endif
187 break;
188 case USB_PORT_FEAT_RESET:
189 dbg_vhci_rh(" SetPortFeature: USB_PORT_FEAT_RESET\n");
190 @@ -432,12 +424,6 @@ static int vhci_hub_control(struct usb_h
191 dum->port_status[rhport] &= ~(USB_PORT_STAT_ENABLE
192 | USB_PORT_STAT_LOW_SPEED
193 | USB_PORT_STAT_HIGH_SPEED);
194 -#if 0
195 - if (dum->driver) {
196 - dev_dbg (hardware, "disconnect\n");
197 - stop_activity (dum, dum->driver);
198 - }
199 -#endif
200
201 /* FIXME test that code path! */
202 }
203 @@ -1060,7 +1046,7 @@ static int vhci_hcd_probe(struct platfor
204 struct usb_hcd *hcd;
205 int ret;
206
207 - uinfo("proving...\n");
208 + uinfo("probing...\n");
209
210 dbg_vhci_hc("name %s id %d\n", pdev->name, pdev->id);
211
212 @@ -1076,7 +1062,11 @@ static int vhci_hcd_probe(struct platfor
213 * Allocate and initialize hcd.
214 * Our private data is also allocated automatically.
215 */
216 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
217 hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, pdev->dev.bus_id);
218 +#else
219 + hcd = usb_create_hcd(&vhci_hc_driver, &pdev->dev, dev_name(&pdev->dev));
220 +#endif
221 if (!hcd) {
222 uerr("create hcd failed\n");
223 return -ENOMEM;
224 --- a/drivers/head/vhci_sysfs.c
225 +++ b/drivers/head/vhci_sysfs.c
226 @@ -123,7 +123,11 @@ static ssize_t show_status(struct device
227 out += sprintf(out, "%03u %08x ",
228 vdev->speed, vdev->devid);
229 out += sprintf(out, "%16p ", vdev->ud.tcp_socket);
230 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
231 out += sprintf(out, "%s", vdev->udev->dev.bus_id);
232 +#else
233 + out += sprintf(out, "%s", dev_name(&vdev->udev->dev));
234 +#endif
235
236 } else
237 out += sprintf(out, "000 000 000 0000000000000000 0-0");
238 --- a/drivers/head/usbip_common.h
239 +++ b/drivers/head/usbip_common.h
240 @@ -300,6 +300,7 @@ struct usbip_device;
241
242 struct usbip_task {
243 struct task_struct *thread;
244 + struct completion thread_started;
245 struct completion thread_done;
246 char *name;
247 void (*loop_ops)(struct usbip_task *);