Commit d1830364 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

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: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20231019102924.2797346-14-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3321f84b
...@@ -1879,7 +1879,6 @@ static void handle_port_status(struct xhci_hcd *xhci, ...@@ -1879,7 +1879,6 @@ static void handle_port_status(struct xhci_hcd *xhci,
if ((port_id <= 0) || (port_id > max_ports)) { if ((port_id <= 0) || (port_id > max_ports)) {
xhci_warn(xhci, "Port change event with invalid port ID %d\n", xhci_warn(xhci, "Port change event with invalid port ID %d\n",
port_id); port_id);
inc_deq(xhci, ir->event_ring);
return; return;
} }
...@@ -2007,8 +2006,6 @@ static void handle_port_status(struct xhci_hcd *xhci, ...@@ -2007,8 +2006,6 @@ static void handle_port_status(struct xhci_hcd *xhci,
} }
cleanup: cleanup:
/* Update event ring dequeue pointer before dropping the lock */
inc_deq(xhci, ir->event_ring);
/* Don't make the USB core poll the roothub if we got a bad port status /* Don't make the USB core poll the roothub if we got a bad port status
* change event. Besides, at that point we can't tell which roothub * 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, ...@@ -2915,7 +2912,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir) static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
{ {
union xhci_trb *event; union xhci_trb *event;
int update_ptrs = 1;
u32 trb_type; u32 trb_type;
/* Event ring hasn't been allocated yet. */ /* Event ring hasn't been allocated yet. */
...@@ -2946,7 +2942,6 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir) ...@@ -2946,7 +2942,6 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
break; break;
case TRB_PORT_STATUS: case TRB_PORT_STATUS:
handle_port_status(xhci, ir, event); handle_port_status(xhci, ir, event);
update_ptrs = 0;
break; break;
case TRB_TRANSFER: case TRB_TRANSFER:
handle_tx_event(xhci, ir, &event->trans_event); handle_tx_event(xhci, ir, &event->trans_event);
...@@ -2969,7 +2964,6 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir) ...@@ -2969,7 +2964,6 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
return 0; return 0;
} }
if (update_ptrs)
/* Update SW event ring dequeue pointer */ /* Update SW event ring dequeue pointer */
inc_deq(xhci, ir->event_ring); inc_deq(xhci, ir->event_ring);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment