xhci: Change xhci_find_slot_id_by_port() API.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Thu, 16 Dec 2010 18:49:09 +0000 (10:49 -0800)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 14 Mar 2011 01:23:38 +0000 (18:23 -0700)
xhci_find_slot_id_by_port() tries to map the port index to the slot ID for
the USB device.  In the future, there will be two xHCI roothubs, and their
port indices will overlap.  Therefore, xhci_find_slot_id_by_port() will
need to use information in the roothub's usb_hcd structure to map the port
index and roothub speed to the right slot ID.

Add a new parameter to xhci_find_slot_id_by_port(), in order to pass in
the roothub's usb_hcd structure.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/host/xhci-hub.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.h

index 4944ba135f9a6244fabb695985df287f53e9527f..4c3788c128df5667f33c7eda5613a5af2f462b07 100644 (file)
@@ -135,7 +135,8 @@ u32 xhci_port_state_to_neutral(u32 state)
 /*
  * find slot id based on port number.
  */
-int xhci_find_slot_id_by_port(struct xhci_hcd *xhci, u16 port)
+int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
+               u16 port)
 {
        int slot_id;
        int i;
@@ -349,7 +350,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 
                                xhci_dbg(xhci, "set port %d resume\n",
                                        wIndex + 1);
-                               slot_id = xhci_find_slot_id_by_port(xhci,
+                               slot_id = xhci_find_slot_id_by_port(hcd, xhci,
                                                                 wIndex + 1);
                                if (!slot_id) {
                                        xhci_dbg(xhci, "slot_id is zero\n");
@@ -404,7 +405,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                                goto error;
                        }
 
-                       slot_id = xhci_find_slot_id_by_port(xhci, wIndex + 1);
+                       slot_id = xhci_find_slot_id_by_port(hcd, xhci,
+                                       wIndex + 1);
                        if (!slot_id) {
                                xhci_warn(xhci, "slot_id is zero\n");
                                goto error;
@@ -498,7 +500,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                                bus_state->port_c_suspend |= 1 << wIndex;
                        }
 
-                       slot_id = xhci_find_slot_id_by_port(xhci, wIndex + 1);
+                       slot_id = xhci_find_slot_id_by_port(hcd, xhci,
+                                       wIndex + 1);
                        if (!slot_id) {
                                xhci_dbg(xhci, "slot_id is zero\n");
                                goto error;
@@ -632,7 +635,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
 
                if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) {
                        xhci_dbg(xhci, "port %d not suspended\n", port_index);
-                       slot_id = xhci_find_slot_id_by_port(xhci,
+                       slot_id = xhci_find_slot_id_by_port(hcd, xhci,
                                        port_index + 1);
                        if (slot_id) {
                                spin_unlock_irqrestore(&xhci->lock, flags);
@@ -748,7 +751,8 @@ int xhci_bus_resume(struct usb_hcd *hcd)
                                temp |= PORT_LINK_STROBE | XDEV_U0;
                                xhci_writel(xhci, temp, port_array[port_index]);
                        }
-                       slot_id = xhci_find_slot_id_by_port(xhci, port_index + 1);
+                       slot_id = xhci_find_slot_id_by_port(hcd,
+                                       xhci, port_index + 1);
                        if (slot_id)
                                xhci_ring_device(xhci, slot_id);
                } else
index 7cea2483e59326effcd67cfe7d544f40acd13175..7fe9aebd3922617a93348238b7e5ecc648d19a09 100644 (file)
@@ -1213,7 +1213,8 @@ static void handle_port_status(struct xhci_hcd *xhci,
                        temp &= ~PORT_PLS_MASK;
                        temp |= PORT_LINK_STROBE | XDEV_U0;
                        xhci_writel(xhci, temp, port_array[faked_port_index]);
-                       slot_id = xhci_find_slot_id_by_port(xhci, port_id);
+                       slot_id = xhci_find_slot_id_by_port(hcd, xhci,
+                                       faked_port_index);
                        if (!slot_id) {
                                xhci_dbg(xhci, "slot_id is zero\n");
                                goto cleanup;
index c15470eb121a1542f57191e05ddd3923ede330f7..443d6333f28094816a6aa68960b4f83c850e8397 100644 (file)
@@ -1533,7 +1533,8 @@ int xhci_bus_resume(struct usb_hcd *hcd);
 #endif /* CONFIG_PM */
 
 u32 xhci_port_state_to_neutral(u32 state);
-int xhci_find_slot_id_by_port(struct xhci_hcd *xhci, u16 port);
+int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
+               u16 port);
 void xhci_ring_device(struct xhci_hcd *xhci, int slot_id);
 
 /* xHCI contexts */