Re: Changes to USB runtime PM

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

 



Am Donnerstag, 26. November 2009 18:22:02 schrieb Alan Stern:
> On Wed, 25 Nov 2009, Oliver Neukum wrote:

> > Yes, all done. As remote wakeup is optional I always want to support
> > devices that don't do it as far as possible.
> 
> Such changes don't take effect until the next
> usb_autopm_put_interface().  This might be an issue during close.  Is
> there always a usb_autopm_put_interface() call after you set
> intf->needs_remote_wakeup to 0?

Yes, as I currently do in such cases exactly for this reason:
usb_autopm_get_interface(intf);
intf->needs_remote_wakeup = 0;
usb_autopm_put_interface(intf);

> If not, you can be most efficient by doing something like this:
> 
> 	if (!disconnected) {
> 		intf->needs_remote_wakeup = 0;
> 		if (currently autosuspended)

How do I do that without a race?

> 			usb_autopm_get_interface_no_resume(intf);
> 		usb_autopm_put_interface(intf);
> 	}
> 
> This way if the device is already suspended, it won't be woken up again
> unnecessarily.

This very much argues for having an API call for requesting
remote wakeup.

> By the way, after the upcoming reimplementation of USB runtime PM,
> drivers will have to make sure their autopm_get and autopm_put calls
> balance -- even if this means doing an autopm_put after the disconnect
> routine has returned.  You'll want to audit a bunch drivers and fix
> them up.

Yes, I am sure you'll warn me.

	Regards
		Oliver
--
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