Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1458579
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] usb: core: Add runtime resume checking |
| Date | 2016-08-09 12:30 +0200 |
| Message-ID | <s4csh-6hI-11@gated-at.bofh.it> (permalink) |
| References | <s4bFT-5HW-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Aug 09, 2016 at 05:33:33PM +0800, Baolin Wang wrote:
> When the usb device has entered suspend state by runtime suspend method, and
> the sustem also try to enter suspend state by issuing usb_dev_suspend(), it
> will issue pm_runtime_resume() function to deal with wrong wakeup setting in
> choose_wakeup() function.
>
> But if usb device resumes failed due to xhci has been into suspend state and
> hardware is not accessible, which will set runtime errors. Thus when there is
> slave attached, usb device will resume failed by runtime resume method due to
> previous runtime errors.
I really can't parse the first sentance in this paragraph, what exactly
makes xhci so "unique" here?
> Then we should check if it resumes successfully in choose_wakeup() function,
what is "it"?
> if it failed we should clear the runtime errors by pm_runtime_set_suspended()
> function to avoid runtime resume failure.
Again, what is "it"?
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
> drivers/usb/core/driver.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> index dadd1e8d..a1a0f5f 100644
> --- a/drivers/usb/core/driver.c
> +++ b/drivers/usb/core/driver.c
> @@ -1412,6 +1412,7 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)
> static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
> {
> int w;
> + int ret;
>
> /* Remote wakeup is needed only when we actually go to sleep.
> * For things like FREEZE and QUIESCE, if the device is already
> @@ -1431,8 +1432,12 @@ static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
> /* If the device is autosuspended with the wrong wakeup setting,
> * autoresume now so the setting can be changed.
> */
> - if (udev->state == USB_STATE_SUSPENDED && w != udev->do_remote_wakeup)
> - pm_runtime_resume(&udev->dev);
> + if (udev->state == USB_STATE_SUSPENDED && w != udev->do_remote_wakeup) {
> + ret = pm_runtime_resume(&udev->dev);
> + if (ret == -ESHUTDOWN)
> + pm_runtime_set_suspended(&udev->dev);
why is 'ret' needed:
if (pm_runtime_resume(&udev->dev) == -ESHUTDOWN)
Why would resume fail?
thanks,
greg k-h
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-09 11:40 +0200
Re: [PATCH] usb: core: Add runtime resume checking Greg KH <gregkh@linuxfoundation.org> - 2016-08-09 12:30 +0200
Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 04:40 +0200
Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 20:20 +0200
Re: [PATCH] usb: core: Add runtime resume checking Alan Stern <stern@rowland.harvard.edu> - 2016-08-10 20:40 +0200
Re: [PATCH] usb: core: Add runtime resume checking Peter Chen <hzpeterchen@gmail.com> - 2016-08-10 20:20 +0200
Re: [PATCH] usb: core: Add runtime resume checking Peter Chen <hzpeterchen@gmail.com> - 2016-08-10 21:30 +0200
Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 22:20 +0200
Re: [PATCH] usb: core: Add runtime resume checking Baolin Wang <baolin.wang@linaro.org> - 2016-08-10 21:30 +0200
csiph-web