aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2013-03-13 18:57:31 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-29 12:29:12 -0400
commit4f48203881ce947a0cbd8ae7b1a1a1b04aaa3766 (patch)
tree522224ae58cbe21d4468cffb2f54af31dd7b5094 /drivers/usb/core
parent70b55c2ad0e5c8bbbb36cedf6a37f9d029cfd403 (diff)
usb: Make USB persist default configurable
Commit 9214d1d8 set the USB persist flag as a default for all devices. This might be desirable for some distributions, but it certainly has its trade-offs... most importantly, it can significantly increase system resume time, because the kernel blocks on resuming (and sometimes resetting) USB devices before it unfreezes userspace. This patch introduces a new config option CONFIG_USB_DEFAULT_PERSIST, which allows distributions to make this decision on their own without the need to carry a custom patch or revert the kernel's setting in userspace. [edited the Kconfig help text a bit - gregkh] Signed-off-by: Julius Werner <jwerner@chromium.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/Kconfig16
-rw-r--r--drivers/usb/core/quirks.c16
2 files changed, 21 insertions, 11 deletions
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 175701a2dae4..7b7305e3abc8 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -27,6 +27,22 @@ config USB_ANNOUNCE_NEW_DEVICES
27comment "Miscellaneous USB options" 27comment "Miscellaneous USB options"
28 depends on USB 28 depends on USB
29 29
30config USB_DEFAULT_PERSIST
31 bool "Enable USB persist by default"
32 depends on USB
33 default y
34 help
35 Say N here if you don't want USB power session persistance
36 enabled by default. If you say N it will make suspended USB
37 devices that lose power get reenumerated as if they had been
38 unplugged, causing any mounted filesystems to be lost. The
39 persist feature can still be enabled for individual devices
40 through the power/persist sysfs node. See
41 Documentation/usb/persist.txt for more info.
42
43 If you have any questions about this, say Y here, only say N
44 if you know exactly what you are doing.
45
30config USB_DYNAMIC_MINORS 46config USB_DYNAMIC_MINORS
31 bool "Dynamic USB minor allocation" 47 bool "Dynamic USB minor allocation"
32 depends on USB 48 depends on USB
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 3113c1d71442..ab5638d9c707 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -201,20 +201,14 @@ void usb_detect_quirks(struct usb_device *udev)
201 dev_dbg(&udev->dev, "USB quirks for this device: %x\n", 201 dev_dbg(&udev->dev, "USB quirks for this device: %x\n",
202 udev->quirks); 202 udev->quirks);
203 203
204 /* For the present, all devices default to USB-PERSIST enabled */ 204#ifdef CONFIG_USB_DEFAULT_PERSIST
205#if 0 /* was: #ifdef CONFIG_PM */ 205 if (!(udev->quirks & USB_QUIRK_RESET))
206 /* Hubs are automatically enabled for USB-PERSIST */
207 if (udev->descriptor.bDeviceClass == USB_CLASS_HUB)
208 udev->persist_enabled = 1; 206 udev->persist_enabled = 1;
209
210#else 207#else
211 /* In the absence of PM, we can safely enable USB-PERSIST 208 /* Hubs are automatically enabled for USB-PERSIST */
212 * for all devices. It will affect things like hub resets 209 if (udev->descriptor.bDeviceClass == USB_CLASS_HUB)
213 * and EMF-related port disables.
214 */
215 if (!(udev->quirks & USB_QUIRK_RESET))
216 udev->persist_enabled = 1; 210 udev->persist_enabled = 1;
217#endif /* CONFIG_PM */ 211#endif /* CONFIG_USB_DEFAULT_PERSIST */
218} 212}
219 213
220void usb_detect_interface_quirks(struct usb_device *udev) 214void usb_detect_interface_quirks(struct usb_device *udev)