Re: [PATCH] usb: avoid PM error messages during resume if a device was disconnected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 23 March 2009, Alan Stern wrote:
> > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> > index d0a21a5..97ea69b 100644
> > --- a/drivers/usb/core/driver.c
> > +++ b/drivers/usb/core/driver.c
> > @@ -1727,6 +1727,10 @@ int usb_external_resume_device(struct usb_device *udev, pm_message_t msg)
> >     status = usb_resume_both(udev, msg);
> >  	udev->last_busy = jiffies;
> >  	usb_pm_unlock(udev);
> > +
> > +	if (status == -ENODEV)
> > +		return 0;
> > +
> >  	if (status == 0)
> >  		do_unbind_rebind(udev, DO_REBIND);
>
> Please include a short comment explaining the reason for this test
> (i.e., that there's no advantage in producing an error message since
> the regular disconnect messages will be generated shortly).

Will do if there are no other comments.

> Or do you think maybe it would be better to move this test up into the
> PM core?  After all, other subsystems will face the same issue.  I
> think that would be the best approach.  Yes?

I did look at that option, but implementing it in the USB subsystem seemed
more logical to me, for example as other subsystems possibly would want to
display an info message.

And is -ENODEV safe to ignore in all cases? Would there be other errors that
should be ignored too?

if Rafael would be happy with a generic test for -ENODEV, it could be done.
If not, maybe some other special error code would need to be used but then
you'd still need to test in the subsystem to set that error.
Disadvantage is also that it would make resume_device() and related PM
driver core functions quite a bit less clean than they currently are.

Implementing the test in USB was quite a bit simpler (for me at least ;-)

Thanks,
FJP
--
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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux