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