diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2008-03-19 16:55:04 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-04-22 05:34:57 -0400 |
commit | 1d1bdd20008416a744c0c844e231e7ba69c11699 (patch) | |
tree | 9b1b1cd36ed6e207402a28613216e514c3783dc8 | |
parent | 1b184cf37f5cf098f07725b483a2055e95725476 (diff) |
HID: move wait from hid to usbhid
Since only place where this is used is usbhid, move it there.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 16 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbhid.h | 3 | ||||
-rw-r--r-- | include/linux/hid.h | 2 |
3 files changed, 10 insertions, 11 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 120b49d2b4a6..f6a5d8930348 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -341,7 +341,7 @@ static void hid_irq_out(struct urb *urb) | |||
341 | if (usbhid->outhead != usbhid->outtail) { | 341 | if (usbhid->outhead != usbhid->outtail) { |
342 | if (hid_submit_out(hid)) { | 342 | if (hid_submit_out(hid)) { |
343 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); | 343 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); |
344 | wake_up(&hid->wait); | 344 | wake_up(&usbhid->wait); |
345 | } | 345 | } |
346 | spin_unlock_irqrestore(&usbhid->outlock, flags); | 346 | spin_unlock_irqrestore(&usbhid->outlock, flags); |
347 | return; | 347 | return; |
@@ -349,7 +349,7 @@ static void hid_irq_out(struct urb *urb) | |||
349 | 349 | ||
350 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); | 350 | clear_bit(HID_OUT_RUNNING, &usbhid->iofl); |
351 | spin_unlock_irqrestore(&usbhid->outlock, flags); | 351 | spin_unlock_irqrestore(&usbhid->outlock, flags); |
352 | wake_up(&hid->wait); | 352 | wake_up(&usbhid->wait); |
353 | } | 353 | } |
354 | 354 | ||
355 | /* | 355 | /* |
@@ -391,7 +391,7 @@ static void hid_ctrl(struct urb *urb) | |||
391 | if (usbhid->ctrlhead != usbhid->ctrltail) { | 391 | if (usbhid->ctrlhead != usbhid->ctrltail) { |
392 | if (hid_submit_ctrl(hid)) { | 392 | if (hid_submit_ctrl(hid)) { |
393 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); | 393 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); |
394 | wake_up(&hid->wait); | 394 | wake_up(&usbhid->wait); |
395 | } | 395 | } |
396 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); | 396 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); |
397 | return; | 397 | return; |
@@ -399,7 +399,7 @@ static void hid_ctrl(struct urb *urb) | |||
399 | 399 | ||
400 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); | 400 | clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); |
401 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); | 401 | spin_unlock_irqrestore(&usbhid->ctrllock, flags); |
402 | wake_up(&hid->wait); | 402 | wake_up(&usbhid->wait); |
403 | } | 403 | } |
404 | 404 | ||
405 | void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) | 405 | void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) |
@@ -478,8 +478,9 @@ int usbhid_wait_io(struct hid_device *hid) | |||
478 | { | 478 | { |
479 | struct usbhid_device *usbhid = hid->driver_data; | 479 | struct usbhid_device *usbhid = hid->driver_data; |
480 | 480 | ||
481 | if (!wait_event_timeout(hid->wait, (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) && | 481 | if (!wait_event_timeout(usbhid->wait, |
482 | !test_bit(HID_OUT_RUNNING, &usbhid->iofl)), | 482 | (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) && |
483 | !test_bit(HID_OUT_RUNNING, &usbhid->iofl)), | ||
483 | 10*HZ)) { | 484 | 10*HZ)) { |
484 | dbg_hid("timeout waiting for ctrl or out queue to clear\n"); | 485 | dbg_hid("timeout waiting for ctrl or out queue to clear\n"); |
485 | return -1; | 486 | return -1; |
@@ -869,8 +870,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
869 | goto fail; | 870 | goto fail; |
870 | } | 871 | } |
871 | 872 | ||
872 | init_waitqueue_head(&hid->wait); | 873 | init_waitqueue_head(&usbhid->wait); |
873 | |||
874 | INIT_WORK(&usbhid->reset_work, hid_reset); | 874 | INIT_WORK(&usbhid->reset_work, hid_reset); |
875 | setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); | 875 | setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); |
876 | 876 | ||
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index 0023f96d4294..62d2d7c925bd 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
31 | #include <linux/wait.h> | ||
31 | #include <linux/workqueue.h> | 32 | #include <linux/workqueue.h> |
32 | #include <linux/input.h> | 33 | #include <linux/input.h> |
33 | 34 | ||
@@ -77,7 +78,7 @@ struct usbhid_device { | |||
77 | unsigned long stop_retry; /* Time to give up, in jiffies */ | 78 | unsigned long stop_retry; /* Time to give up, in jiffies */ |
78 | unsigned int retry_delay; /* Delay length in ms */ | 79 | unsigned int retry_delay; /* Delay length in ms */ |
79 | struct work_struct reset_work; /* Task context for resets */ | 80 | struct work_struct reset_work; /* Task context for resets */ |
80 | 81 | wait_queue_head_t wait; /* For sleeping */ | |
81 | }; | 82 | }; |
82 | 83 | ||
83 | #define hid_to_usb_dev(hid_dev) \ | 84 | #define hid_to_usb_dev(hid_dev) \ |
diff --git a/include/linux/hid.h b/include/linux/hid.h index 69ba58434dcb..9db600f72e2a 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -455,8 +455,6 @@ struct hid_device { /* device report descriptor */ | |||
455 | void *hidraw; | 455 | void *hidraw; |
456 | int minor; /* Hiddev minor number */ | 456 | int minor; /* Hiddev minor number */ |
457 | 457 | ||
458 | wait_queue_head_t wait; /* For sleeping */ | ||
459 | |||
460 | int open; /* is the device open by anyone? */ | 458 | int open; /* is the device open by anyone? */ |
461 | char name[128]; /* Device name */ | 459 | char name[128]; /* Device name */ |
462 | char phys[64]; /* Device physical location */ | 460 | char phys[64]; /* Device physical location */ |