USB: make autosuspend delay a module parameter
This patch (as859) makes the default USB autosuspend delay a module parameter of usbcore. By setting the delay value at boot time, users will be able to prevent the system from autosuspending devices which for some reason can't handle it. The patch also stores the autosuspend delay as a per-device value. A later patch will allow the user to change the value, tailoring the delay for each individual device. A delay value of 0 will prevent autosuspend. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
aa084f3efe
commit
b5e795f8df
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/slab.h>
|
||||
@ -50,6 +51,16 @@ static int nousb; /* Disable USB when built into kernel image */
|
||||
|
||||
struct workqueue_struct *ksuspend_usb_wq; /* For autosuspend */
|
||||
|
||||
#ifdef CONFIG_USB_SUSPEND
|
||||
static int usb_autosuspend_delay = 2; /* Default delay value,
|
||||
* in seconds */
|
||||
module_param_named(autosuspend, usb_autosuspend_delay, uint, 0644);
|
||||
MODULE_PARM_DESC(autosuspend, "default autosuspend delay");
|
||||
|
||||
#else
|
||||
#define usb_autosuspend_delay 0
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* usb_ifnum_to_if - get the interface object with a given interface number
|
||||
@ -306,6 +317,7 @@ usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1)
|
||||
#ifdef CONFIG_PM
|
||||
mutex_init(&dev->pm_mutex);
|
||||
INIT_DELAYED_WORK(&dev->autosuspend, usb_autosuspend_work);
|
||||
dev->autosuspend_delay = usb_autosuspend_delay * HZ;
|
||||
#endif
|
||||
return dev;
|
||||
}
|
||||
|
Reference in New Issue
Block a user