Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d97b4f8d authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman
Browse files

xhci: don't use the same variable for stopped and halted rings current TD



Endpoints halted on errors, and endpoints stopped manually both used
the same ep->stopped_td to store the halted or stopped td. this causes
confusion and possible races.

There is no longer a need to use the ep->stopped_td variable to store
the halted TD. A halted endpoint is handled immediately and we can pass
it to the handling function directly.

Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4801d4ea
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -716,8 +716,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,
		ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
		ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
	}
	}


	/* Clear stopped_td if endpoint is not halted */
	if (!(ep->ep_state & EP_HALTED))
	ep->stopped_td = NULL;
	ep->stopped_td = NULL;


	/*
	/*
@@ -1732,13 +1730,11 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
		return;
		return;


	ep->ep_state |= EP_HALTED;
	ep->ep_state |= EP_HALTED;
	ep->stopped_td = td;
	ep->stopped_stream = stream_id;
	ep->stopped_stream = stream_id;


	xhci_queue_reset_ep(xhci, command, slot_id, ep_index);
	xhci_queue_reset_ep(xhci, command, slot_id, ep_index);
	xhci_cleanup_stalled_ring(xhci, td->urb->dev, ep_index);
	xhci_cleanup_stalled_ring(xhci, ep_index, td);


	ep->stopped_td = NULL;
	ep->stopped_stream = 0;
	ep->stopped_stream = 0;


	xhci_ring_cmd_db(xhci);
	xhci_ring_cmd_db(xhci);
+3 −3
Original line number Original line Diff line number Diff line
@@ -2912,10 +2912,11 @@ static void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci,
}
}


void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
		struct usb_device *udev, unsigned int ep_index)
			unsigned int ep_index, struct xhci_td *td)
{
{
	struct xhci_dequeue_state deq_state;
	struct xhci_dequeue_state deq_state;
	struct xhci_virt_ep *ep;
	struct xhci_virt_ep *ep;
	struct usb_device *udev = td->urb->dev;


	xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
	xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
			"Cleaning up stalled endpoint ring");
			"Cleaning up stalled endpoint ring");
@@ -2924,8 +2925,7 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
	 * or it will attempt to resend it on the next doorbell ring.
	 * or it will attempt to resend it on the next doorbell ring.
	 */
	 */
	xhci_find_new_dequeue_state(xhci, udev->slot_id,
	xhci_find_new_dequeue_state(xhci, udev->slot_id,
			ep_index, ep->stopped_stream, ep->stopped_td,
			ep_index, ep->stopped_stream, td, &deq_state);
			&deq_state);


	if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg)
	if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg)
		return;
		return;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1825,7 +1825,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci,
		unsigned int stream_id,
		unsigned int stream_id,
		struct xhci_dequeue_state *deq_state);
		struct xhci_dequeue_state *deq_state);
void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci,
		struct usb_device *udev, unsigned int ep_index);
		unsigned int ep_index, struct xhci_td *td);
void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci,
void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci,
		unsigned int slot_id, unsigned int ep_index,
		unsigned int slot_id, unsigned int ep_index,
		struct xhci_dequeue_state *deq_state);
		struct xhci_dequeue_state *deq_state);