From: Gabriele Mazzotta Date: Tue, 7 Jul 2015 19:58:02 +0000 (+0200) Subject: HID: i2c-hid: Call device suspend callback before disabling irq X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=af4739c281621017a8a84dd6ba3471bba2dd6c6a;p=deliverable%2Flinux.git HID: i2c-hid: Call device suspend callback before disabling irq i2c-hid takes care of requesting and handling IRQs for HID devices which in turns might expect them to be always active when working in normal conditions. Hence, disabling IRQs before calling the suspend callbacks can potentially cause problems since device drivers might try to perform operations needing them. Fix this by disabling IRQs only after the suspend callbacks had been executed. Signed-off-by: Gabriele Mazzotta Reviewed-by: Benjamin Tissoires Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index f77469d4edfb..9ed69b5121f7 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -1092,13 +1092,13 @@ static int i2c_hid_suspend(struct device *dev) struct hid_device *hid = ihid->hid; int ret = 0; + if (hid->driver && hid->driver->suspend) + ret = hid->driver->suspend(hid, PMSG_SUSPEND); + disable_irq(ihid->irq); if (device_may_wakeup(&client->dev)) enable_irq_wake(ihid->irq); - if (hid->driver && hid->driver->suspend) - ret = hid->driver->suspend(hid, PMSG_SUSPEND); - /* Save some power */ i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);