Commit cac72b99 authored by Lyude's avatar Lyude Committed by Jiri Kosina

HID: rmi: Make sure the HID device is opened on resume

So it looks like that suspend/resume has actually always been broken on
hid-rmi. The fact it worked was a rather silly coincidence that was
relying on the HID device to already be opened upon resume. This means
that so long as anything was reading the /dev/input/eventX node for for
an RMI device, it would suspend and resume correctly. As well, if
nothing happened to be keeping the HID device away it would shut off,
then the RMI driver would get confused on resume when it stopped
responding and explode.

So, call hid_hw_open() in rmi_post_resume() so we make sure that the
device is alive before we try talking to it.

This fixes RMI device suspend/resume over HID.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196851
[jkosina@suse.cz: removed useless hunk that was zero-initializing 'ret']
Signed-off-by: default avatarLyude <lyude@redhat.com>
Cc: Andrew Duggan <aduggan@synaptics.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent fcaa4a07
...@@ -436,17 +436,24 @@ static int rmi_post_resume(struct hid_device *hdev) ...@@ -436,17 +436,24 @@ static int rmi_post_resume(struct hid_device *hdev)
if (!(data->device_flags & RMI_DEVICE)) if (!(data->device_flags & RMI_DEVICE))
return 0; return 0;
ret = rmi_reset_attn_mode(hdev); /* Make sure the HID device is ready to receive events */
ret = hid_hw_open(hdev);
if (ret) if (ret)
return ret; return ret;
ret = rmi_reset_attn_mode(hdev);
if (ret)
goto out;
ret = rmi_driver_resume(rmi_dev, false); ret = rmi_driver_resume(rmi_dev, false);
if (ret) { if (ret) {
hid_warn(hdev, "Failed to resume device: %d\n", ret); hid_warn(hdev, "Failed to resume device: %d\n", ret);
return ret; goto out;
} }
return 0; out:
hid_hw_close(hdev);
return ret;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment