diff options
Diffstat (limited to 'drivers/usb/misc/phidgetmotorcontrol.c')
-rw-r--r-- | drivers/usb/misc/phidgetmotorcontrol.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index 5c780cab92e0..5727e1ea2f91 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c | |||
@@ -41,7 +41,7 @@ struct motorcontrol { | |||
41 | unsigned char *data; | 41 | unsigned char *data; |
42 | dma_addr_t data_dma; | 42 | dma_addr_t data_dma; |
43 | 43 | ||
44 | struct work_struct do_notify; | 44 | struct delayed_work do_notify; |
45 | unsigned long input_events; | 45 | unsigned long input_events; |
46 | unsigned long speed_events; | 46 | unsigned long speed_events; |
47 | unsigned long exceed_events; | 47 | unsigned long exceed_events; |
@@ -148,10 +148,10 @@ static void motorcontrol_irq(struct urb *urb) | |||
148 | set_bit(1, &mc->exceed_events); | 148 | set_bit(1, &mc->exceed_events); |
149 | 149 | ||
150 | if (mc->input_events || mc->exceed_events || mc->speed_events) | 150 | if (mc->input_events || mc->exceed_events || mc->speed_events) |
151 | schedule_work(&mc->do_notify); | 151 | schedule_delayed_work(&mc->do_notify, 0); |
152 | 152 | ||
153 | resubmit: | 153 | resubmit: |
154 | status = usb_submit_urb(urb, SLAB_ATOMIC); | 154 | status = usb_submit_urb(urb, GFP_ATOMIC); |
155 | if (status) | 155 | if (status) |
156 | dev_err(&mc->intf->dev, | 156 | dev_err(&mc->intf->dev, |
157 | "can't resubmit intr, %s-%s/motorcontrol0, status %d", | 157 | "can't resubmit intr, %s-%s/motorcontrol0, status %d", |
@@ -159,9 +159,10 @@ resubmit: | |||
159 | mc->udev->devpath, status); | 159 | mc->udev->devpath, status); |
160 | } | 160 | } |
161 | 161 | ||
162 | static void do_notify(void *data) | 162 | static void do_notify(struct work_struct *work) |
163 | { | 163 | { |
164 | struct motorcontrol *mc = data; | 164 | struct motorcontrol *mc = |
165 | container_of(work, struct motorcontrol, do_notify.work); | ||
165 | int i; | 166 | int i; |
166 | char sysfs_file[8]; | 167 | char sysfs_file[8]; |
167 | 168 | ||
@@ -323,7 +324,7 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
323 | return -ENODEV; | 324 | return -ENODEV; |
324 | 325 | ||
325 | endpoint = &interface->endpoint[0].desc; | 326 | endpoint = &interface->endpoint[0].desc; |
326 | if (!(endpoint->bEndpointAddress & 0x80)) | 327 | if (!usb_endpoint_dir_in(endpoint)) |
327 | return -ENODEV; | 328 | return -ENODEV; |
328 | 329 | ||
329 | /* | 330 | /* |
@@ -337,7 +338,7 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
337 | goto out; | 338 | goto out; |
338 | 339 | ||
339 | mc->dev_no = -1; | 340 | mc->dev_no = -1; |
340 | mc->data = usb_buffer_alloc(dev, URB_INT_SIZE, SLAB_ATOMIC, &mc->data_dma); | 341 | mc->data = usb_buffer_alloc(dev, URB_INT_SIZE, GFP_ATOMIC, &mc->data_dma); |
341 | if (!mc->data) | 342 | if (!mc->data) |
342 | goto out; | 343 | goto out; |
343 | 344 | ||
@@ -348,7 +349,7 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
348 | mc->udev = usb_get_dev(dev); | 349 | mc->udev = usb_get_dev(dev); |
349 | mc->intf = intf; | 350 | mc->intf = intf; |
350 | mc->acceleration[0] = mc->acceleration[1] = 10; | 351 | mc->acceleration[0] = mc->acceleration[1] = 10; |
351 | INIT_WORK(&mc->do_notify, do_notify, mc); | 352 | INIT_DELAYED_WORK(&mc->do_notify, do_notify); |
352 | usb_fill_int_urb(mc->irq, mc->udev, pipe, mc->data, | 353 | usb_fill_int_urb(mc->irq, mc->udev, pipe, mc->data, |
353 | maxp > URB_INT_SIZE ? URB_INT_SIZE : maxp, | 354 | maxp > URB_INT_SIZE ? URB_INT_SIZE : maxp, |
354 | motorcontrol_irq, mc, endpoint->bInterval); | 355 | motorcontrol_irq, mc, endpoint->bInterval); |
@@ -392,8 +393,7 @@ out2: | |||
392 | device_remove_file(mc->dev, &dev_attrs[i]); | 393 | device_remove_file(mc->dev, &dev_attrs[i]); |
393 | out: | 394 | out: |
394 | if (mc) { | 395 | if (mc) { |
395 | if (mc->irq) | 396 | usb_free_urb(mc->irq); |
396 | usb_free_urb(mc->irq); | ||
397 | if (mc->data) | 397 | if (mc->data) |
398 | usb_buffer_free(dev, URB_INT_SIZE, mc->data, mc->data_dma); | 398 | usb_buffer_free(dev, URB_INT_SIZE, mc->data, mc->data_dma); |
399 | if (mc->dev) | 399 | if (mc->dev) |