diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-07-19 16:08:45 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-07-20 05:24:24 -0400 |
commit | f2b5264d4f77328e45d73cd135772b6e88a4951a (patch) | |
tree | b23f34186a53e7692e7f950d6237e901dc34c59a | |
parent | 93101af31bc5df4486103f6b3ef212aaa5341b09 (diff) |
HID: usbhid: replace HID_REPORTED_IDLE with HID_SUSPENDED
This patch (as1595) improves the usbhid driver by using the
HID_SUSPENDED bitflag to indicate that the device is suspended rather
than using HID_REPORTED_IDLE, which the patch removes.
Since HID_SUSPENDED was not being used for anything, and since the
name "HID_REPORTED_IDLE" doesn't convey much meaning, the end result
is easier to read and understand.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 14 | ||||
-rw-r--r-- | drivers/hid/usbhid/usbhid.h | 1 |
2 files changed, 7 insertions, 8 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 0fa07d95202d..271578b85d91 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -84,7 +84,7 @@ static int hid_start_in(struct hid_device *hid) | |||
84 | spin_lock_irqsave(&usbhid->lock, flags); | 84 | spin_lock_irqsave(&usbhid->lock, flags); |
85 | if (hid->open > 0 && | 85 | if (hid->open > 0 && |
86 | !test_bit(HID_DISCONNECTED, &usbhid->iofl) && | 86 | !test_bit(HID_DISCONNECTED, &usbhid->iofl) && |
87 | !test_bit(HID_REPORTED_IDLE, &usbhid->iofl) && | 87 | !test_bit(HID_SUSPENDED, &usbhid->iofl) && |
88 | !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) { | 88 | !test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) { |
89 | rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC); | 89 | rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC); |
90 | if (rc != 0) { | 90 | if (rc != 0) { |
@@ -222,7 +222,7 @@ static int usbhid_restart_out_queue(struct usbhid_device *usbhid) | |||
222 | * If still suspended, don't submit. Submission will | 222 | * If still suspended, don't submit. Submission will |
223 | * occur if/when resume drains the queue. | 223 | * occur if/when resume drains the queue. |
224 | */ | 224 | */ |
225 | if (test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) { | 225 | if (test_bit(HID_SUSPENDED, &usbhid->iofl)) { |
226 | usb_autopm_put_interface_no_suspend(usbhid->intf); | 226 | usb_autopm_put_interface_no_suspend(usbhid->intf); |
227 | return r; | 227 | return r; |
228 | } | 228 | } |
@@ -260,7 +260,7 @@ static int usbhid_restart_ctrl_queue(struct usbhid_device *usbhid) | |||
260 | * If still suspended, don't submit. Submission will | 260 | * If still suspended, don't submit. Submission will |
261 | * occur if/when resume drains the queue. | 261 | * occur if/when resume drains the queue. |
262 | */ | 262 | */ |
263 | if (test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) { | 263 | if (test_bit(HID_SUSPENDED, &usbhid->iofl)) { |
264 | usb_autopm_put_interface_no_suspend(usbhid->intf); | 264 | usb_autopm_put_interface_no_suspend(usbhid->intf); |
265 | return r; | 265 | return r; |
266 | } | 266 | } |
@@ -1475,7 +1475,7 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1475 | && !test_bit(HID_KEYS_PRESSED, &usbhid->iofl) | 1475 | && !test_bit(HID_KEYS_PRESSED, &usbhid->iofl) |
1476 | && (!usbhid->ledcount || ignoreled)) | 1476 | && (!usbhid->ledcount || ignoreled)) |
1477 | { | 1477 | { |
1478 | set_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1478 | set_bit(HID_SUSPENDED, &usbhid->iofl); |
1479 | spin_unlock_irq(&usbhid->lock); | 1479 | spin_unlock_irq(&usbhid->lock); |
1480 | if (hid->driver && hid->driver->suspend) { | 1480 | if (hid->driver && hid->driver->suspend) { |
1481 | status = hid->driver->suspend(hid, message); | 1481 | status = hid->driver->suspend(hid, message); |
@@ -1495,7 +1495,7 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1495 | return status; | 1495 | return status; |
1496 | } | 1496 | } |
1497 | spin_lock_irq(&usbhid->lock); | 1497 | spin_lock_irq(&usbhid->lock); |
1498 | set_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1498 | set_bit(HID_SUSPENDED, &usbhid->iofl); |
1499 | spin_unlock_irq(&usbhid->lock); | 1499 | spin_unlock_irq(&usbhid->lock); |
1500 | if (usbhid_wait_io(hid) < 0) | 1500 | if (usbhid_wait_io(hid) < 0) |
1501 | return -EIO; | 1501 | return -EIO; |
@@ -1525,7 +1525,7 @@ static int hid_resume(struct usb_interface *intf) | |||
1525 | if (!test_bit(HID_STARTED, &usbhid->iofl)) | 1525 | if (!test_bit(HID_STARTED, &usbhid->iofl)) |
1526 | return 0; | 1526 | return 0; |
1527 | 1527 | ||
1528 | clear_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1528 | clear_bit(HID_SUSPENDED, &usbhid->iofl); |
1529 | usbhid_mark_busy(usbhid); | 1529 | usbhid_mark_busy(usbhid); |
1530 | 1530 | ||
1531 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl) || | 1531 | if (test_bit(HID_CLEAR_HALT, &usbhid->iofl) || |
@@ -1552,7 +1552,7 @@ static int hid_reset_resume(struct usb_interface *intf) | |||
1552 | struct usbhid_device *usbhid = hid->driver_data; | 1552 | struct usbhid_device *usbhid = hid->driver_data; |
1553 | int status; | 1553 | int status; |
1554 | 1554 | ||
1555 | clear_bit(HID_REPORTED_IDLE, &usbhid->iofl); | 1555 | clear_bit(HID_SUSPENDED, &usbhid->iofl); |
1556 | status = hid_post_reset(intf); | 1556 | status = hid_post_reset(intf); |
1557 | if (status >= 0 && hid->driver && hid->driver->reset_resume) { | 1557 | if (status >= 0 && hid->driver && hid->driver->reset_resume) { |
1558 | int ret = hid->driver->reset_resume(hid); | 1558 | int ret = hid->driver->reset_resume(hid); |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index 1883d7b94870..bd87a61e5303 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -53,7 +53,6 @@ struct usb_interface *usbhid_find_interface(int minor); | |||
53 | #define HID_CLEAR_HALT 6 | 53 | #define HID_CLEAR_HALT 6 |
54 | #define HID_DISCONNECTED 7 | 54 | #define HID_DISCONNECTED 7 |
55 | #define HID_STARTED 8 | 55 | #define HID_STARTED 8 |
56 | #define HID_REPORTED_IDLE 9 | ||
57 | #define HID_KEYS_PRESSED 10 | 56 | #define HID_KEYS_PRESSED 10 |
58 | #define HID_NO_BANDWIDTH 11 | 57 | #define HID_NO_BANDWIDTH 11 |
59 | 58 | ||