On Wed, Mar 6, 2013 at 3:06 PM, Bjørn Mork <bjorn@xxxxxxx> wrote: > Ming Lei <ming.lei@xxxxxxxxxxxxx> writes: >> On Wed, Mar 6, 2013 at 10:51 AM, Ming Lei <ming.lei@xxxxxxxxxxxxx> wrote: >>> On Wed, Mar 6, 2013 at 12:08 AM, Bjørn Mork <bjorn@xxxxxxx> wrote: >>> >>>> I guess proper error handling here require the USB core to see the >>>> interface driver as dead if it fails to suspend on system suspend, and >>>> do forced rebinding on resume. >>> >>> The idea should be fine, but may cause regression of user space, suppose >>> one device with suspend failure can be across suspend-resume cycle and >>> work well before, but it is no longer with your forced rebinding. >> >> Give the potential cost(user space regression) of doing rebind, I think it >> is better to try to recover the device in resume() first, then >> consider rebinding >> as the last straw. In fact, I am also wondering if resume() can't recover one >> device but probe() can, maybe we can always let resume() recover the >> device which experienced suspend failure. > > Yes, sure. Drivers wanting to do this, anticipating typical errors, can > still return 0 from suspend and do whatever they want in resume. > > My proposal is to make the USB core properly deal with drivers returning > an error from suspend, and also document the fact that a driver should > always return 0 on system suspend unless it really want forced unbinding > on suspend errors. > >> I remember that some guys went against rebinding during system sleep before >> in the firmware loading discussion. > > Yes, that is probably relevant. I'll look it up. Thanks for the > pointer. You are welcome! Here is one link I found: http://marc.info/?l=linux-usb&m=132557022902261&w=2 IMO, we unbind interface which hasn't suspend/resume callback during suspend because there is no better way to handle the case. But for the suspend failure case, maybe rebind isn't necessary, and we can document that drivers have to handle their system suspend failure in resume(), where it is very suitable to do PM recovery. Also we may store the failure code into usb_interface, and let USB core check if the suspend failure has been handled/cleared after resume(). Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html