linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [06/18] xhci: Add helper to get xhci roothub from hcd
@ 2018-05-21 13:39 Mathias Nyman
  0 siblings, 0 replies; only message in thread
From: Mathias Nyman @ 2018-05-21 13:39 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman

quick way to get the xhci roothub and thus all the ports
belonging to a certain hcd

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-hub.c | 9 +++++++++
 drivers/usb/host/xhci.h     | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 32cd52c..b6fd26f 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -554,6 +554,15 @@ static int xhci_get_ports(struct usb_hcd *hcd, __le32 __iomem ***port_array)
 	return max_ports;
 }
 
+struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd)
+{
+	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
+
+	if (hcd->speed >= HCD_USB3)
+		return &xhci->usb3_rhub;
+	return &xhci->usb2_rhub;
+}
+
 static __le32 __iomem *xhci_get_port_io_addr(struct usb_hcd *hcd, int index)
 {
 	__le32 __iomem **port_array;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 38aa8a6..cdf8e1a 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2110,6 +2110,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
 		char *buf, u16 wLength);
 int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
 int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1);
+struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd);
+
 void xhci_hc_died(struct xhci_hcd *xhci);
 
 #ifdef CONFIG_PM

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-21 13:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-21 13:39 [06/18] xhci: Add helper to get xhci roothub from hcd Mathias Nyman

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).