* [PATCH] usbhid: correct PM failure with closed devices
@ 2015-04-15 13:18 Oliver Neukum
2015-04-15 14:56 ` Alan Stern
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2015-04-15 13:18 UTC (permalink / raw)
To: jkosina-AlSwsSmVLrQ, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz
Cc: Oliver Neukum
When usbhid closes a device which was awake only because remote
wakeup was required but not provided, the interface must go through
a get/put cycle or the core will never reattempt to suspend the device.
This brakes runtime PM for all joysticks.
Signed-off-by: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
---
drivers/hid/usbhid/hid-core.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index bfbe1be..63d1f0f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -734,7 +734,15 @@ void usbhid_close(struct hid_device *hid)
hid_cancel_delayed_stuff(usbhid);
if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL)) {
usb_kill_urb(usbhid->urbin);
+ /*
+ * We need a put on the interface to force
+ * a recheck needed in case only a lack
+ * of capability to do remote wakeup
+ * kept us awake
+ */
+ usb_autopm_get_interface(usbhid->intf);
usbhid->intf->needs_remote_wakeup = 0;
+ usb_autopm_put_interface(usbhid->intf);
}
} else {
spin_unlock_irq(&usbhid->lock);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usbhid: correct PM failure with closed devices
2015-04-15 13:18 [PATCH] usbhid: correct PM failure with closed devices Oliver Neukum
@ 2015-04-15 14:56 ` Alan Stern
0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2015-04-15 14:56 UTC (permalink / raw)
To: Oliver Neukum; +Cc: jkosina, linux-usb, linux-input
On Wed, 15 Apr 2015, Oliver Neukum wrote:
> When usbhid closes a device which was awake only because remote
> wakeup was required but not provided, the interface must go through
> a get/put cycle or the core will never reattempt to suspend the device.
> This brakes runtime PM for all joysticks.
>
> Signed-off-by: Oliver Neukum <oneukum@suse.de>
This seems reasonable, although it would be nice if there was a way to
do this without waking up the device if it was already in runtime
suspend. Perhaps make the get/put conditional on
pm_runtime_active(&usbhid->intf->dev)? It's okay to do the get/put
cycle after setting needs_remote_wakeup to 0.
By the way, how does the HID core handle the case where the device file
is closed long after the device has disconnected?
Alan Stern
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-15 14:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-15 13:18 [PATCH] usbhid: correct PM failure with closed devices Oliver Neukum
2015-04-15 14:56 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).