Ming Lei <ming.lei@xxxxxxxxxxxxx> writes: > Here is one link I found: > > http://marc.info/?l=linux-usb&m=132557022902261&w=2 Thanks. This section caught my eye: "The USB suspend/resume code is full of those crazy "let's use one function, and pass it as an *argument* what to do". It's a disease. The PM layer used to do the same thing (PMSG_xyz crap), and we've largely gotten rid of it, but USB still plays around with those things and makes it even *worse* exactly with these kinds of "do_unbind_rebind()" routines that then look at the argument instead of having a sane routine for unbinding and another sane routine for re-binding." I take that as supporting my view on all the "if (PMSG_IS_AUTO(msg)" testing... But I don't have any ideas on how to fix it now that you all have spoon fed me the background. > 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. Yup, agreed, although I fear that if Alan's commit messages are confused then I unable explain anything like this ;) > 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(). That sounds unnecessarily complicated. Let the driver deal with it, keeping the API as simple as possible. Bjørn -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html