USB: export autosuspend delay in sysfs

This patch (as861) adds sysfs attributes to expose the autosuspend
delay value for each USB device.  If the user changes the delay from 0
(no autosuspend) to a positive value, an autosuspend is attempted.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Alan Stern
2007-02-20 15:03:32 -05:00
committed by Greg Kroah-Hartman
parent dfa87c824a
commit 19c262391c
3 changed files with 87 additions and 1 deletions

View File

@@ -1224,6 +1224,26 @@ void usb_autosuspend_device(struct usb_device *udev)
// __FUNCTION__, udev->pm_usage_cnt);
}
/**
* usb_try_autosuspend_device - attempt an autosuspend of a USB device and its interfaces
* @udev: the usb_device to autosuspend
*
* This routine should be called when a core subsystem thinks @udev may
* be ready to autosuspend.
*
* @udev's usage counter left unchanged. If it or any of the usage counters
* for an active interface is greater than 0, or autosuspend is not allowed
* for any other reason, no autosuspend request will be queued.
*
* This routine can run only in process context.
*/
void usb_try_autosuspend_device(struct usb_device *udev)
{
usb_autopm_do_device(udev, 0);
// dev_dbg(&udev->dev, "%s: cnt %d\n",
// __FUNCTION__, udev->pm_usage_cnt);
}
/**
* usb_autoresume_device - immediately autoresume a USB device and its interfaces
* @udev: the usb_device to autoresume