diff mbox series

usb: xhci: only set D3hot for pci device

Message ID 20191112071831.1043-1-henryl@nvidia.com (mailing list archive)
State Superseded
Headers show
Series usb: xhci: only set D3hot for pci device | expand

Commit Message

Henry Lin Nov. 12, 2019, 7:18 a.m. UTC
xhci driver cannot call pci_set_power_state() on non-pci xhci host
controllers.

Signed-off-by: Henry Lin <henryl@nvidia.com>
---
 drivers/usb/host/xhci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6c17e3fe181a..1fc16763dcda 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -761,6 +761,8 @@  static void xhci_stop(struct usb_hcd *hcd)
 	mutex_unlock(&xhci->mutex);
 }
 
+extern struct device_type pci_dev_type;
+
 /*
  * Shutdown HC (not bus-specific)
  *
@@ -791,8 +793,12 @@  static void xhci_shutdown(struct usb_hcd *hcd)
 			readl(&xhci->op_regs->status));
 
 	/* Yet another workaround for spurious wakeups at shutdown with HSW */
-	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
-		pci_set_power_state(to_pci_dev(hcd->self.sysdev), PCI_D3hot);
+	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) {
+		struct device *dev = hcd->self.sysdev;
+
+		if (dev->type == &pci_dev_type)
+			pci_set_power_state(to_pci_dev(dev), PCI_D3hot);
+	}
 }
 
 #ifdef CONFIG_PM