Commit 1d1bdd20 authored by Jiri Slaby's avatar Jiri Slaby Committed by Jiri Kosina

HID: move wait from hid to usbhid

Since only place where this is used is usbhid, move it there.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 1b184cf3
...@@ -341,7 +341,7 @@ static void hid_irq_out(struct urb *urb) ...@@ -341,7 +341,7 @@ static void hid_irq_out(struct urb *urb)
if (usbhid->outhead != usbhid->outtail) { if (usbhid->outhead != usbhid->outtail) {
if (hid_submit_out(hid)) { if (hid_submit_out(hid)) {
clear_bit(HID_OUT_RUNNING, &usbhid->iofl); clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
wake_up(&hid->wait); wake_up(&usbhid->wait);
} }
spin_unlock_irqrestore(&usbhid->outlock, flags); spin_unlock_irqrestore(&usbhid->outlock, flags);
return; return;
...@@ -349,7 +349,7 @@ static void hid_irq_out(struct urb *urb) ...@@ -349,7 +349,7 @@ static void hid_irq_out(struct urb *urb)
clear_bit(HID_OUT_RUNNING, &usbhid->iofl); clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
spin_unlock_irqrestore(&usbhid->outlock, flags); spin_unlock_irqrestore(&usbhid->outlock, flags);
wake_up(&hid->wait); wake_up(&usbhid->wait);
} }
/* /*
...@@ -391,7 +391,7 @@ static void hid_ctrl(struct urb *urb) ...@@ -391,7 +391,7 @@ static void hid_ctrl(struct urb *urb)
if (usbhid->ctrlhead != usbhid->ctrltail) { if (usbhid->ctrlhead != usbhid->ctrltail) {
if (hid_submit_ctrl(hid)) { if (hid_submit_ctrl(hid)) {
clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
wake_up(&hid->wait); wake_up(&usbhid->wait);
} }
spin_unlock_irqrestore(&usbhid->ctrllock, flags); spin_unlock_irqrestore(&usbhid->ctrllock, flags);
return; return;
...@@ -399,7 +399,7 @@ static void hid_ctrl(struct urb *urb) ...@@ -399,7 +399,7 @@ static void hid_ctrl(struct urb *urb)
clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
spin_unlock_irqrestore(&usbhid->ctrllock, flags); spin_unlock_irqrestore(&usbhid->ctrllock, flags);
wake_up(&hid->wait); wake_up(&usbhid->wait);
} }
void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) 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,8 +478,9 @@ int usbhid_wait_io(struct hid_device *hid)
{ {
struct usbhid_device *usbhid = hid->driver_data; struct usbhid_device *usbhid = hid->driver_data;
if (!wait_event_timeout(hid->wait, (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) && if (!wait_event_timeout(usbhid->wait,
!test_bit(HID_OUT_RUNNING, &usbhid->iofl)), (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl) &&
!test_bit(HID_OUT_RUNNING, &usbhid->iofl)),
10*HZ)) { 10*HZ)) {
dbg_hid("timeout waiting for ctrl or out queue to clear\n"); dbg_hid("timeout waiting for ctrl or out queue to clear\n");
return -1; return -1;
...@@ -869,8 +870,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) ...@@ -869,8 +870,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
goto fail; goto fail;
} }
init_waitqueue_head(&hid->wait); init_waitqueue_head(&usbhid->wait);
INIT_WORK(&usbhid->reset_work, hid_reset); INIT_WORK(&usbhid->reset_work, hid_reset);
setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/wait.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -77,7 +78,7 @@ struct usbhid_device { ...@@ -77,7 +78,7 @@ struct usbhid_device {
unsigned long stop_retry; /* Time to give up, in jiffies */ unsigned long stop_retry; /* Time to give up, in jiffies */
unsigned int retry_delay; /* Delay length in ms */ unsigned int retry_delay; /* Delay length in ms */
struct work_struct reset_work; /* Task context for resets */ struct work_struct reset_work; /* Task context for resets */
wait_queue_head_t wait; /* For sleeping */
}; };
#define hid_to_usb_dev(hid_dev) \ #define hid_to_usb_dev(hid_dev) \
......
...@@ -455,8 +455,6 @@ struct hid_device { /* device report descriptor */ ...@@ -455,8 +455,6 @@ struct hid_device { /* device report descriptor */
void *hidraw; void *hidraw;
int minor; /* Hiddev minor number */ int minor; /* Hiddev minor number */
wait_queue_head_t wait; /* For sleeping */
int open; /* is the device open by anyone? */ int open; /* is the device open by anyone? */
char name[128]; /* Device name */ char name[128]; /* Device name */
char phys[64]; /* Device physical location */ char phys[64]; /* Device physical location */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment