Skip to content

Commit 75b040e

Browse files
SkyRzngregkh
authored andcommitted
usb: xhci: remove duplicate function xhci_urb_to_transfer_ring
Remove duplicate function xhci_urb_to_transfer_ring from xhci.c. We have same function in xhci-ring.c. Signed-off-by: Alexandr Ivanov <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d251034 commit 75b040e

File tree

3 files changed

+16
-53
lines changed

3 files changed

+16
-53
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,11 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci,
373373
}
374374
}
375375

376-
static struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci,
376+
/* Get the right ring for the given slot_id, ep_index and stream_id.
377+
* If the endpoint supports streams, boundary check the URB's stream ID.
378+
* If the endpoint doesn't support streams, return the singular endpoint ring.
379+
*/
380+
struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci,
377381
unsigned int slot_id, unsigned int ep_index,
378382
unsigned int stream_id)
379383
{
@@ -405,17 +409,6 @@ static struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci,
405409
return NULL;
406410
}
407411

408-
/* Get the right ring for the given URB.
409-
* If the endpoint supports streams, boundary check the URB's stream ID.
410-
* If the endpoint doesn't support streams, return the singular endpoint ring.
411-
*/
412-
static struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci,
413-
struct urb *urb)
414-
{
415-
return xhci_triad_to_transfer_ring(xhci, urb->dev->slot_id,
416-
xhci_get_endpoint_index(&urb->ep->desc), urb->stream_id);
417-
}
418-
419412
/*
420413
* Move the xHC's endpoint ring dequeue pointer past cur_td.
421414
* Record the new state of the xHC's endpoint ring dequeue segment,

drivers/usb/host/xhci.c

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,47 +1459,6 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
14591459
return ret;
14601460
}
14611461

1462-
/* Get the right ring for the given URB.
1463-
* If the endpoint supports streams, boundary check the URB's stream ID.
1464-
* If the endpoint doesn't support streams, return the singular endpoint ring.
1465-
*/
1466-
static struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci,
1467-
struct urb *urb)
1468-
{
1469-
unsigned int slot_id;
1470-
unsigned int ep_index;
1471-
unsigned int stream_id;
1472-
struct xhci_virt_ep *ep;
1473-
1474-
slot_id = urb->dev->slot_id;
1475-
ep_index = xhci_get_endpoint_index(&urb->ep->desc);
1476-
stream_id = urb->stream_id;
1477-
ep = &xhci->devs[slot_id]->eps[ep_index];
1478-
/* Common case: no streams */
1479-
if (!(ep->ep_state & EP_HAS_STREAMS))
1480-
return ep->ring;
1481-
1482-
if (stream_id == 0) {
1483-
xhci_warn(xhci,
1484-
"WARN: Slot ID %u, ep index %u has streams, "
1485-
"but URB has no stream ID.\n",
1486-
slot_id, ep_index);
1487-
return NULL;
1488-
}
1489-
1490-
if (stream_id < ep->stream_info->num_streams)
1491-
return ep->stream_info->stream_rings[stream_id];
1492-
1493-
xhci_warn(xhci,
1494-
"WARN: Slot ID %u, ep index %u has "
1495-
"stream IDs 1 to %u allocated, "
1496-
"but stream ID %u is requested.\n",
1497-
slot_id, ep_index,
1498-
ep->stream_info->num_streams - 1,
1499-
stream_id);
1500-
return NULL;
1501-
}
1502-
15031462
/*
15041463
* Remove the URB's TD from the endpoint ring. This may cause the HC to stop
15051464
* USB transfers, potentially stopping in the middle of a TRB buffer. The HC

drivers/usb/host/xhci.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,4 +1968,15 @@ struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_container_
19681968
struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx);
19691969
struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index);
19701970

1971+
struct xhci_ring *xhci_triad_to_transfer_ring(struct xhci_hcd *xhci,
1972+
unsigned int slot_id, unsigned int ep_index,
1973+
unsigned int stream_id);
1974+
static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci,
1975+
struct urb *urb)
1976+
{
1977+
return xhci_triad_to_transfer_ring(xhci, urb->dev->slot_id,
1978+
xhci_get_endpoint_index(&urb->ep->desc),
1979+
urb->stream_id);
1980+
}
1981+
19711982
#endif /* __LINUX_XHCI_HCD_H */

0 commit comments

Comments
 (0)