Skip to content

Commit af4739c

Browse files
gm-vmJiri Kosina
authored andcommitted
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 <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 67db8a8 commit af4739c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/hid/i2c-hid/i2c-hid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,13 +1092,13 @@ static int i2c_hid_suspend(struct device *dev)
10921092
struct hid_device *hid = ihid->hid;
10931093
int ret = 0;
10941094

1095+
if (hid->driver && hid->driver->suspend)
1096+
ret = hid->driver->suspend(hid, PMSG_SUSPEND);
1097+
10951098
disable_irq(ihid->irq);
10961099
if (device_may_wakeup(&client->dev))
10971100
enable_irq_wake(ihid->irq);
10981101

1099-
if (hid->driver && hid->driver->suspend)
1100-
ret = hid->driver->suspend(hid, PMSG_SUSPEND);
1101-
11021102
/* Save some power */
11031103
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
11041104

0 commit comments

Comments
 (0)