aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-08-19 17:49:48 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-08-19 17:49:48 -0400
commit5b1b0b812a7b1a5b968c5d06d90d1cb88621b941 (patch)
treedd57943592e4152147d1a5667b082e5f30faaf83 /drivers/hid
parent311aab73d273eb22be976055f6cab224f7279d5e (diff)
PM / Runtime: Add macro to test for runtime PM events
This patch (as1482) adds a macro for testing whether or not a pm_message value represents an autosuspend or autoresume (i.e., a runtime PM) event. Encapsulating this notion seems preferable to open-coding the test all over the place. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-picolcd.c2
-rw-r--r--drivers/hid/usbhid/hid-core.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index 9d8710f8bc79..1782693819f3 100644
--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -2409,7 +2409,7 @@ static int picolcd_raw_event(struct hid_device *hdev,
2409#ifdef CONFIG_PM 2409#ifdef CONFIG_PM
2410static int picolcd_suspend(struct hid_device *hdev, pm_message_t message) 2410static int picolcd_suspend(struct hid_device *hdev, pm_message_t message)
2411{ 2411{
2412 if (message.event & PM_EVENT_AUTO) 2412 if (PMSG_IS_AUTO(message))
2413 return 0; 2413 return 0;
2414 2414
2415 picolcd_suspend_backlight(hid_get_drvdata(hdev)); 2415 picolcd_suspend_backlight(hid_get_drvdata(hdev));
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index ad978f5748d3..a9fa294ee7d3 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1332,7 +1332,7 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1332 struct usbhid_device *usbhid = hid->driver_data; 1332 struct usbhid_device *usbhid = hid->driver_data;
1333 int status; 1333 int status;
1334 1334
1335 if (message.event & PM_EVENT_AUTO) { 1335 if (PMSG_IS_AUTO(message)) {
1336 spin_lock_irq(&usbhid->lock); /* Sync with error handler */ 1336 spin_lock_irq(&usbhid->lock); /* Sync with error handler */
1337 if (!test_bit(HID_RESET_PENDING, &usbhid->iofl) 1337 if (!test_bit(HID_RESET_PENDING, &usbhid->iofl)
1338 && !test_bit(HID_CLEAR_HALT, &usbhid->iofl) 1338 && !test_bit(HID_CLEAR_HALT, &usbhid->iofl)
@@ -1367,7 +1367,7 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1367 return -EIO; 1367 return -EIO;
1368 } 1368 }
1369 1369
1370 if (!ignoreled && (message.event & PM_EVENT_AUTO)) { 1370 if (!ignoreled && PMSG_IS_AUTO(message)) {
1371 spin_lock_irq(&usbhid->lock); 1371 spin_lock_irq(&usbhid->lock);
1372 if (test_bit(HID_LED_ON, &usbhid->iofl)) { 1372 if (test_bit(HID_LED_ON, &usbhid->iofl)) {
1373 spin_unlock_irq(&usbhid->lock); 1373 spin_unlock_irq(&usbhid->lock);
@@ -1380,8 +1380,7 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1380 hid_cancel_delayed_stuff(usbhid); 1380 hid_cancel_delayed_stuff(usbhid);
1381 hid_cease_io(usbhid); 1381 hid_cease_io(usbhid);
1382 1382
1383 if ((message.event & PM_EVENT_AUTO) && 1383 if (PMSG_IS_AUTO(message) && test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) {
1384 test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) {
1385 /* lost race against keypresses */ 1384 /* lost race against keypresses */
1386 status = hid_start_in(hid); 1385 status = hid_start_in(hid);
1387 if (status < 0) 1386 if (status < 0)