diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2014-03-03 12:30:17 -0500 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2014-03-06 16:46:55 -0500 |
commit | bcffae7708eb8352f44dc510b326541fe43a02a4 (patch) | |
tree | 73fe0025c28060ac45e8f5e2e346894c910ed227 | |
parent | 14aec589327a6fc4035f5327d90ac5548f501c4c (diff) |
xhci: Prevent runtime pm from autosuspending during initialization
xHCI driver has its own pci probe function that will call usb_hcd_pci_probe
to register its usb-2 bus, and then continue to manually register the
usb-3 bus. usb_hcd_pci_probe does a pm_runtime_put_noidle at the end and
might thus trigger a runtime suspend before the usb-3 bus is ready.
Prevent the runtime suspend by increasing the usage count in the
beginning of xhci_pci_probe, and decrease it once the usb-3 bus is
ready.
xhci-platform driver is not using usb_hcd_pci_probe to set up
busses and should not need to have it's usage count increased during probe.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
-rw-r--r-- | drivers/usb/host/xhci-pci.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index cbf0c5cffc92..47390e369cd4 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -190,6 +190,10 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
190 | struct usb_hcd *hcd; | 190 | struct usb_hcd *hcd; |
191 | 191 | ||
192 | driver = (struct hc_driver *)id->driver_data; | 192 | driver = (struct hc_driver *)id->driver_data; |
193 | |||
194 | /* Prevent runtime suspending between USB-2 and USB-3 initialization */ | ||
195 | pm_runtime_get_noresume(&dev->dev); | ||
196 | |||
193 | /* Register the USB 2.0 roothub. | 197 | /* Register the USB 2.0 roothub. |
194 | * FIXME: USB core must know to register the USB 2.0 roothub first. | 198 | * FIXME: USB core must know to register the USB 2.0 roothub first. |
195 | * This is sort of silly, because we could just set the HCD driver flags | 199 | * This is sort of silly, because we could just set the HCD driver flags |
@@ -199,7 +203,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
199 | retval = usb_hcd_pci_probe(dev, id); | 203 | retval = usb_hcd_pci_probe(dev, id); |
200 | 204 | ||
201 | if (retval) | 205 | if (retval) |
202 | return retval; | 206 | goto put_runtime_pm; |
203 | 207 | ||
204 | /* USB 2.0 roothub is stored in the PCI device now. */ | 208 | /* USB 2.0 roothub is stored in the PCI device now. */ |
205 | hcd = dev_get_drvdata(&dev->dev); | 209 | hcd = dev_get_drvdata(&dev->dev); |
@@ -225,12 +229,17 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
225 | if (HCC_MAX_PSA(xhci->hcc_params) >= 4) | 229 | if (HCC_MAX_PSA(xhci->hcc_params) >= 4) |
226 | xhci->shared_hcd->can_do_streams = 1; | 230 | xhci->shared_hcd->can_do_streams = 1; |
227 | 231 | ||
232 | /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ | ||
233 | pm_runtime_put_noidle(&dev->dev); | ||
234 | |||
228 | return 0; | 235 | return 0; |
229 | 236 | ||
230 | put_usb3_hcd: | 237 | put_usb3_hcd: |
231 | usb_put_hcd(xhci->shared_hcd); | 238 | usb_put_hcd(xhci->shared_hcd); |
232 | dealloc_usb2_hcd: | 239 | dealloc_usb2_hcd: |
233 | usb_hcd_pci_remove(dev); | 240 | usb_hcd_pci_remove(dev); |
241 | put_runtime_pm: | ||
242 | pm_runtime_put_noidle(&dev->dev); | ||
234 | return retval; | 243 | return retval; |
235 | } | 244 | } |
236 | 245 | ||