[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1411131539330.929-100000@iolanthe.rowland.org>
Date: Thu, 13 Nov 2014 15:41:43 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Benson Leung <bleung@...omium.org>
cc: johan@...nel.org, <jkosina@...e.cz>, <linux-usb@...r.kernel.org>,
<linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<snanda@...omium.org>
Subject: Re: [PATCH] HID: usbhid: get/put around clearing needs_remote_wakeup
On Thu, 13 Nov 2014, Benson Leung wrote:
> usbhid->intf->needs_remote_wakeup is set when a device is
> opened, and is cleared when a device is closed.
>
> When a usbhid device that does not support remote wake
> ( i.e. !device_can_wakeup() ) is closed, we fail out of
> autosuspend_check() because the autosuspend check is called
> before the flag is cleared as a result of usb_kill_urb(usbhid->urbin);
>
> The result is that a device that may otherwise autosuspend will
> fail to enter suspend again after all handles to it are closed.
>
> In usbhid_open, usb_autopm_get_interface is called
> before setting the needs_remote_wakeup flag, and
> usb_autopm_put_interface is called after hid_start_in.
>
> However, when the device is closed in usbhid_close, the same
> protection isn't there when clearing needs_remote_wakeup. This will
> add that to usbhid_close as well as usbhid_stop.
usbhid_stop probably doesn't need it. And it should be possible to fix
usbhid_close more easily just by interchanging the two lines:
- usb_kill_urb(usbhid->urbin);
usbhid->intf->needs_remote_wakeup = 0;
+ usb_kill_urb(usbhid->urbin);
Have you tried this?
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists