Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af4739c2 authored by Gabriele Mazzotta's avatar Gabriele Mazzotta Committed by Jiri Kosina
Browse files

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: default avatarGabriele Mazzotta <gabriele.mzt@gmail.com>
Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
parent 67db8a80
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -1092,13 +1092,13 @@ static int i2c_hid_suspend(struct device *dev)
	struct hid_device *hid = ihid->hid;
	struct hid_device *hid = ihid->hid;
	int ret = 0;
	int ret = 0;


	if (hid->driver && hid->driver->suspend)
		ret = hid->driver->suspend(hid, PMSG_SUSPEND);

	disable_irq(ihid->irq);
	disable_irq(ihid->irq);
	if (device_may_wakeup(&client->dev))
	if (device_may_wakeup(&client->dev))
		enable_irq_wake(ihid->irq);
		enable_irq_wake(ihid->irq);


	if (hid->driver && hid->driver->suspend)
		ret = hid->driver->suspend(hid, PMSG_SUSPEND);

	/* Save some power */
	/* Save some power */
	i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
	i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);