[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVMDNtJOp+8jMOuhCBjrqq-L=jicEJBr_=ErG19Vr+7OGw@mail.gmail.com>
Date: Tue, 5 Mar 2013 23:29:15 +0800
From: Ming Lei <ming.lei@...onical.com>
To: Bjørn Mork <bjorn@...k.no>
Cc: "David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Kosina <jkosina@...e.cz>,
Alan Stern <stern@...land.harvard.edu>,
Oliver Neukum <oneukum@...e.de>, netdev@...r.kernel.org,
linux-usb@...r.kernel.org, linux-input@...r.kernel.org
Subject: Re: [PATCH 4/7] usbnet: cdc_mbim: don't recover device if suspend
fails in system sleep
On Tue, Mar 5, 2013 at 11:03 PM, Bjørn Mork <bjorn@...k.no> wrote:
> Ming Lei <ming.lei@...onical.com> writes:
>> On Tue, Mar 5, 2013 at 9:46 PM, Bjørn Mork <bjorn@...k.no> wrote:
>>
>>> Now, after inspecting wdm_suspend() which hides behind
>>> info->subdriver->suspend(), I see that this is a completely theoretical
>>> discussion as it always will return 0 if PMSG_IS_AUTO(msg) is true...
>>>
>>> Which means that your change really is a noop(). I still don't like it,
>>> because it gives the impression that errors from info->subdriver->suspend()
>>> isn't dealt with.
>>
>> Yes, it needn't dealt with in system sleep, so it has the document benefit.
>
> The document that the return code is ignored by forcing it to 0 and
> always return success.
>
> But am still not convinced this is correct in any way. AFAICS there is
> no documentation stating that the drivers should care about what the USB
We have source code, :-)
> core use the return value for. Drivers are allowed to fail and the core
> will ignore and clean up if necessary.
>
> I still find any partial failures horrendous. If we are not going to
> fail on errors, then we'll return success and pretend to be suspended.
>
>> No, USB core does not handle it, and will always ignore the return
>> failure from driver's suspend, see usb_suspend_both() for non-autosuspend
>> case.
>
> Right you are. Somehow I read the inverse. Sorry about that.
>
> In any case, it ends up here and everythin will be OK, which I assume is
> why it can ignore the errors:
>
> /* If the suspend succeeded then prevent any more URB submissions
> * and flush any outstanding URBs.
> */
> } else {
> udev->can_submit = 0;
> for (i = 0; i < 16; ++i) {
> usb_hcd_flush_endpoint(udev, udev->ep_out[i]);
> usb_hcd_flush_endpoint(udev, udev->ep_in[i]);
> }
> }
Yes, USB core will flush any outstanding URBs, but the driver still need
to deal with suspend failure carefully, for example, suppose usb_resume()
is called in suspend failure path, and the submitted URBs are killed
by USB core later. But after the device is wakeup, and the resume() will
do nothing since the suspend count is leaked. So it is what the patches
are fixing, and it is better to not depend on the default flushing URBs of
USB core.
Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists