Skip to content

Commit d183036

Browse files
matnymangregkh
authored andcommitted
xhci: Simplify event ring dequeue pointer update for port change events
Increase the event ring dequeue pointer for port change events in the same way as other event types. No need to handle it separately. This only touches the driver side tracking of event ring dequeue. Note: this does move forward the event ring dequeue increase for port change events a bit. Previously the dequeue was increased before temporarily dropping the xhci lock while kicking roothub polling. Now dequeue is increased after re-aquiring the lock. This should not matter as event ring dequeue is not touched at all by hub thread. It's only touched in xhci interrupt handler. Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20231019102924.2797346-14-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3321f84 commit d183036

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,6 @@ static void handle_port_status(struct xhci_hcd *xhci,
18791879
if ((port_id <= 0) || (port_id > max_ports)) {
18801880
xhci_warn(xhci, "Port change event with invalid port ID %d\n",
18811881
port_id);
1882-
inc_deq(xhci, ir->event_ring);
18831882
return;
18841883
}
18851884

@@ -2007,8 +2006,6 @@ static void handle_port_status(struct xhci_hcd *xhci,
20072006
}
20082007

20092008
cleanup:
2010-
/* Update event ring dequeue pointer before dropping the lock */
2011-
inc_deq(xhci, ir->event_ring);
20122009

20132010
/* Don't make the USB core poll the roothub if we got a bad port status
20142011
* change event. Besides, at that point we can't tell which roothub
@@ -2915,7 +2912,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
29152912
static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
29162913
{
29172914
union xhci_trb *event;
2918-
int update_ptrs = 1;
29192915
u32 trb_type;
29202916

29212917
/* Event ring hasn't been allocated yet. */
@@ -2946,7 +2942,6 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
29462942
break;
29472943
case TRB_PORT_STATUS:
29482944
handle_port_status(xhci, ir, event);
2949-
update_ptrs = 0;
29502945
break;
29512946
case TRB_TRANSFER:
29522947
handle_tx_event(xhci, ir, &event->trans_event);
@@ -2969,9 +2964,8 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
29692964
return 0;
29702965
}
29712966

2972-
if (update_ptrs)
2973-
/* Update SW event ring dequeue pointer */
2974-
inc_deq(xhci, ir->event_ring);
2967+
/* Update SW event ring dequeue pointer */
2968+
inc_deq(xhci, ir->event_ring);
29752969

29762970
/* Are there more items on the event ring? Caller will call us again to
29772971
* check.

0 commit comments

Comments
 (0)