diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 782ce2e31c7f..988f227e796f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -4784,6 +4784,10 @@ static void port_event(struct usb_hub *hub, int port1) | |||
4784 | USB_PORT_FEAT_C_PORT_CONFIG_ERROR); | 4784 | USB_PORT_FEAT_C_PORT_CONFIG_ERROR); |
4785 | } | 4785 | } |
4786 | 4786 | ||
4787 | /* skip port actions that require the port to be powered on */ | ||
4788 | if (!pm_runtime_active(&port_dev->dev)) | ||
4789 | return; | ||
4790 | |||
4787 | if (hub_handle_remote_wakeup(hub, port1, portstatus, portchange)) | 4791 | if (hub_handle_remote_wakeup(hub, port1, portstatus, portchange)) |
4788 | connect_change = 1; | 4792 | connect_change = 1; |
4789 | 4793 | ||
@@ -4910,11 +4914,26 @@ static void hub_events(void) | |||
4910 | 4914 | ||
4911 | /* deal with port status changes */ | 4915 | /* deal with port status changes */ |
4912 | for (i = 1; i <= hdev->maxchild; i++) { | 4916 | for (i = 1; i <= hdev->maxchild; i++) { |
4917 | struct usb_port *port_dev = hub->ports[i - 1]; | ||
4918 | |||
4913 | if (!test_bit(i, hub->busy_bits) | 4919 | if (!test_bit(i, hub->busy_bits) |
4914 | && (test_bit(i, hub->event_bits) | 4920 | && (test_bit(i, hub->event_bits) |
4915 | || test_bit(i, hub->change_bits) | 4921 | || test_bit(i, hub->change_bits) |
4916 | || test_bit(i, hub->wakeup_bits))) | 4922 | || test_bit(i, hub->wakeup_bits))) { |
4923 | /* | ||
4924 | * The get_noresume and barrier ensure that if | ||
4925 | * the port was in the process of resuming, we | ||
4926 | * flush that work and keep the port active for | ||
4927 | * the duration of the port_event(). However, | ||
4928 | * if the port is runtime pm suspended | ||
4929 | * (powered-off), we leave it in that state, run | ||
4930 | * an abbreviated port_event(), and move on. | ||
4931 | */ | ||
4932 | pm_runtime_get_noresume(&port_dev->dev); | ||
4933 | pm_runtime_barrier(&port_dev->dev); | ||
4917 | port_event(hub, i); | 4934 | port_event(hub, i); |
4935 | pm_runtime_put_sync(&port_dev->dev); | ||
4936 | } | ||
4918 | } | 4937 | } |
4919 | 4938 | ||
4920 | /* deal with hub status changes */ | 4939 | /* deal with hub status changes */ |