Changes to USB runtime PM

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

 



On Wed, 25 Nov 2009, Oliver Neukum wrote:

> > Am Mittwoch, 25. November 2009 19:31:09 schrieb Alan Stern:
> > This reminds me...  In your autosuspend additions to the various
> > networking and serial drivers, did you set intf->needs_remote_wakeup
> > dynamically?  If an interface is down or a serial device is closed then
> > remote wakeup isn't needed, otherwise it is.  This will affect the 
> > kinds of autosuspends and autoresumes we can perform.
> 
> 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?

If not, you can be most efficient by doing something like this:

	if (!disconnected) {
		intf->needs_remote_wakeup = 0;
		if (currently autosuspended)
			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.

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.

Alan Stern

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