aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLyude <lyude@redhat.com>2017-07-22 21:15:09 -0400
committerJiri Kosina <jkosina@suse.cz>2017-09-08 09:00:52 -0400
commitcac72b990d34f4c70208998a86f910ba38253c94 (patch)
tree2c358932e4a0e67fc584cb1fa805d89a80852046
parentfcaa4a07d2a4b541e91da7a55d8b3331f96d1865 (diff)
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: Lyude <lyude@redhat.com> Cc: Andrew Duggan <aduggan@synaptics.com> Cc: stable@vger.kernel.org Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-rmi.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 5b40c2614599..ef241d66562e 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -436,17 +436,24 @@ static int rmi_post_resume(struct hid_device *hdev)
436 if (!(data->device_flags & RMI_DEVICE)) 436 if (!(data->device_flags & RMI_DEVICE))
437 return 0; 437 return 0;
438 438
439 ret = rmi_reset_attn_mode(hdev); 439 /* Make sure the HID device is ready to receive events */
440 ret = hid_hw_open(hdev);
440 if (ret) 441 if (ret)
441 return ret; 442 return ret;
442 443
444 ret = rmi_reset_attn_mode(hdev);
445 if (ret)
446 goto out;
447
443 ret = rmi_driver_resume(rmi_dev, false); 448 ret = rmi_driver_resume(rmi_dev, false);
444 if (ret) { 449 if (ret) {
445 hid_warn(hdev, "Failed to resume device: %d\n", ret); 450 hid_warn(hdev, "Failed to resume device: %d\n", ret);
446 return ret; 451 goto out;
447 } 452 }
448 453
449 return 0; 454out:
455 hid_hw_close(hdev);
456 return ret;
450} 457}
451#endif /* CONFIG_PM */ 458#endif /* CONFIG_PM */
452 459