aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8a4dcbc7a75f..d481c99a20d7 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1728,8 +1728,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
1728 * - Change autosuspend delay of hub can avoid unnecessary auto 1728 * - Change autosuspend delay of hub can avoid unnecessary auto
1729 * suspend timer for hub, also may decrease power consumption 1729 * suspend timer for hub, also may decrease power consumption
1730 * of USB bus. 1730 * of USB bus.
1731 *
1732 * - If user has indicated to prevent autosuspend by passing
1733 * usbcore.autosuspend = -1 then keep autosuspend disabled.
1731 */ 1734 */
1732 pm_runtime_set_autosuspend_delay(&hdev->dev, 0); 1735#ifdef CONFIG_PM_RUNTIME
1736 if (hdev->dev.power.autosuspend_delay >= 0)
1737 pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
1738#endif
1733 1739
1734 /* 1740 /*
1735 * Hubs have proper suspend/resume support, except for root hubs 1741 * Hubs have proper suspend/resume support, except for root hubs
@@ -2107,8 +2113,8 @@ void usb_disconnect(struct usb_device **pdev)
2107{ 2113{
2108 struct usb_port *port_dev = NULL; 2114 struct usb_port *port_dev = NULL;
2109 struct usb_device *udev = *pdev; 2115 struct usb_device *udev = *pdev;
2110 struct usb_hub *hub; 2116 struct usb_hub *hub = NULL;
2111 int port1; 2117 int port1 = 1;
2112 2118
2113 /* mark the device as inactive, so any further urb submissions for 2119 /* mark the device as inactive, so any further urb submissions for
2114 * this device (and any of its children) will fail immediately. 2120 * this device (and any of its children) will fail immediately.
@@ -4631,9 +4637,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
4631 if (status != -ENODEV && 4637 if (status != -ENODEV &&
4632 port1 != unreliable_port && 4638 port1 != unreliable_port &&
4633 printk_ratelimit()) 4639 printk_ratelimit())
4634 dev_err(&udev->dev, "connect-debounce failed, port %d disabled\n", 4640 dev_err(&port_dev->dev, "connect-debounce failed\n");
4635 port1);
4636
4637 portstatus &= ~USB_PORT_STAT_CONNECTION; 4641 portstatus &= ~USB_PORT_STAT_CONNECTION;
4638 unreliable_port = port1; 4642 unreliable_port = port1;
4639 } else { 4643 } else {
@@ -5020,9 +5024,10 @@ static void hub_events(void)
5020 5024
5021 hub = list_entry(tmp, struct usb_hub, event_list); 5025 hub = list_entry(tmp, struct usb_hub, event_list);
5022 kref_get(&hub->kref); 5026 kref_get(&hub->kref);
5027 hdev = hub->hdev;
5028 usb_get_dev(hdev);
5023 spin_unlock_irq(&hub_event_lock); 5029 spin_unlock_irq(&hub_event_lock);
5024 5030
5025 hdev = hub->hdev;
5026 hub_dev = hub->intfdev; 5031 hub_dev = hub->intfdev;
5027 intf = to_usb_interface(hub_dev); 5032 intf = to_usb_interface(hub_dev);
5028 dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", 5033 dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n",
@@ -5135,6 +5140,7 @@ static void hub_events(void)
5135 usb_autopm_put_interface(intf); 5140 usb_autopm_put_interface(intf);
5136 loop_disconnected: 5141 loop_disconnected:
5137 usb_unlock_device(hdev); 5142 usb_unlock_device(hdev);
5143 usb_put_dev(hdev);
5138 kref_put(&hub->kref, hub_release); 5144 kref_put(&hub->kref, hub_release);
5139 5145
5140 } /* end while (1) */ 5146 } /* end while (1) */