linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: only set D3hot for pci device
@ 2019-11-12  7:18 Henry Lin
  2019-11-13  1:49 ` [PATCH v2] " Henry Lin
  0 siblings, 1 reply; 9+ messages in thread
From: Henry Lin @ 2019-11-12  7:18 UTC (permalink / raw)
  Cc: Henry Lin, Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel

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 --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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-21  2:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12  7:18 [PATCH] usb: xhci: only set D3hot for pci device Henry Lin
2019-11-13  1:49 ` [PATCH v2] " Henry Lin
2019-11-15 15:05   ` Mathias Nyman
2019-11-19  7:46     ` Henry Lin
2019-11-19  8:16   ` [PATCH v3] " Henry Lin
2019-11-19 14:57     ` Mathias Nyman
2019-11-20 19:16     ` Jack Pham
     [not found]     ` <0101016e8a3ed405-a70f7e87-8c4b-4759-910f-9b9753a9dabb-000000@us-west-2.amazonses.com>
2019-11-21  1:53       ` Henry Lin
2019-11-21  2:07     ` [PATCH v4] " Henry Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).