aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/Kconfig7
-rw-r--r--drivers/usb/core/hcd-pci.c7
-rw-r--r--drivers/usb/core/hcd.c13
-rw-r--r--drivers/usb/core/hub.c31
-rw-r--r--drivers/usb/core/usb.c2
5 files changed, 36 insertions, 24 deletions
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index ff03184da403..a08787e253aa 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -99,4 +99,11 @@ config USB_OTG_WHITELIST
normal Linux-USB hosts do (other than the warning), and is
convenient for many stages of product development.
+config USB_OTG_BLACKLIST_HUB
+ bool "Disable external hubs"
+ depends on USB_OTG
+ help
+ If you say Y here, then Linux will refuse to enumerate
+ external hubs. OTG hosts are allowed to reduce hardware
+ and software costs by not supporting external hubs.
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 0d2193b69235..66b78404ab34 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -213,11 +213,9 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
if (hcd->driver->suspend) {
retval = hcd->driver->suspend(hcd, message);
- if (retval) {
- dev_dbg (&dev->dev, "PCI pre-suspend fail, %d\n",
- retval);
+ suspend_report_result(hcd->driver->suspend, retval);
+ if (retval)
goto done;
- }
}
synchronize_irq(dev->irq);
@@ -263,6 +261,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
* some device state (e.g. as part of clock reinit).
*/
retval = pci_set_power_state (dev, PCI_D3hot);
+ suspend_report_result(pci_set_power_state, retval);
if (retval == 0) {
int wake = device_can_wakeup(&hcd->self.root_hub->dev);
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fbd938d4ea58..e2e00ba4e1e6 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1805,6 +1805,12 @@ int usb_add_hcd(struct usb_hcd *hcd,
USB_SPEED_FULL;
hcd->self.root_hub = rhdev;
+ /* wakeup flag init defaults to "everything works" for root hubs,
+ * but drivers can override it in reset() if needed, along with
+ * recording the overall controller's system wakeup capability.
+ */
+ device_init_wakeup(&rhdev->dev, 1);
+
/* "reset" is misnamed; its role is now one-time init. the controller
* should already have been reset (and boot firmware kicked off etc).
*/
@@ -1813,13 +1819,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
goto err_hcd_driver_setup;
}
- /* wakeup flag init is in transition; for now we can't rely on PCI to
- * initialize these bits properly, so we let reset() override it.
- * This init should _precede_ the reset() once PCI behaves.
- */
- device_init_wakeup(&rhdev->dev,
- device_can_wakeup(hcd->self.controller));
-
/* NOTE: root hub and controller capabilities may not be the same */
if (device_can_wakeup(hcd->self.controller)
&& device_can_wakeup(&hcd->self.root_hub->dev))
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8e65f7a237e4..90b8d43c6b33 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -836,6 +836,13 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
desc = intf->cur_altsetting;
hdev = interface_to_usbdev(intf);
+#ifdef CONFIG_USB_OTG_BLACKLIST_HUB
+ if (hdev->parent) {
+ dev_warn(&intf->dev, "ignoring external hub\n");
+ return -ENODEV;
+ }
+#endif
+
/* Some hubs have a subclass of 1, which AFAICT according to the */
/* specs is not defined, but it works */
if ((desc->desc.bInterfaceSubClass != 0) &&
@@ -1022,7 +1029,6 @@ void usb_set_device_state(struct usb_device *udev,
recursively_mark_NOTATTACHED(udev);
spin_unlock_irqrestore(&device_state_lock, flags);
}
-EXPORT_SYMBOL(usb_set_device_state);
#ifdef CONFIG_PM
@@ -1162,19 +1168,9 @@ static inline const char *plural(int n)
static int choose_configuration(struct usb_device *udev)
{
int i;
- u16 devstatus;
- int bus_powered;
int num_configs;
struct usb_host_config *c, *best;
- /* If this fails, assume the device is bus-powered */
- devstatus = 0;
- usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
- le16_to_cpus(&devstatus);
- bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0);
- dev_dbg(&udev->dev, "device is %s-powered\n",
- bus_powered ? "bus" : "self");
-
best = NULL;
c = udev->config;
num_configs = udev->descriptor.bNumConfigurations;
@@ -1191,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev)
* similar errors in their descriptors. If the next test
* were allowed to execute, such configurations would always
* be rejected and the devices would not work as expected.
+ * In the meantime, we run the risk of selecting a config
+ * that requires external power at a time when that power
+ * isn't available. It seems to be the lesser of two evils.
+ *
+ * Bugzilla #6448 reports a device that appears to crash
+ * when it receives a GET_DEVICE_STATUS request! We don't
+ * have any other way to tell whether a device is self-powered,
+ * but since we don't use that information anywhere but here,
+ * the call has been removed.
+ *
+ * Maybe the GET_DEVICE_STATUS call and the test below can
+ * be reinstated when device firmwares become more reliable.
+ * Don't hold your breath.
*/
#if 0
/* Rule out self-powered configs for a bus-powered device */
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index d7352aa73b5e..b7fdc1cd134a 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1194,7 +1194,6 @@ EXPORT_SYMBOL(usb_disabled);
EXPORT_SYMBOL_GPL(usb_get_intf);
EXPORT_SYMBOL_GPL(usb_put_intf);
-EXPORT_SYMBOL(usb_alloc_dev);
EXPORT_SYMBOL(usb_put_dev);
EXPORT_SYMBOL(usb_get_dev);
EXPORT_SYMBOL(usb_hub_tt_clear_buffer);
@@ -1208,7 +1207,6 @@ EXPORT_SYMBOL(usb_ifnum_to_if);
EXPORT_SYMBOL(usb_altnum_to_altsetting);
EXPORT_SYMBOL(usb_reset_device);
-EXPORT_SYMBOL(usb_disconnect);
EXPORT_SYMBOL(__usb_get_extra_descriptor);