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

Commit 1193ebd5 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: f_qdss: Avoid wait_for_completion if qdss_disable is called"

parents dba0d3ef a270f4a0
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
/*
 * f_qdss.c -- QDSS function Driver
 *
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/init.h>
@@ -909,15 +909,20 @@ void usb_qdss_close(struct usb_qdss_ch *ch)
	if (!qdss)
		goto close;
	qdss->qdss_close = true;
	spin_lock(&qdss->lock);
	while (!list_empty(&qdss->queued_data_pool)) {
		qreq = list_first_entry(&qdss->queued_data_pool,
				struct qdss_req, list);
		spin_unlock(&qdss->lock);
		spin_unlock_irqrestore(&channel_lock, flags);
		usb_ep_dequeue(qdss->port.data, qreq->usb_req);
		qdss_log("dequeue req:%pK\n", qreq->usb_req);
		if (!usb_ep_dequeue(qdss->port.data, qreq->usb_req))
			wait_for_completion(&qreq->write_done);
		spin_lock_irqsave(&channel_lock, flags);
		spin_lock(&qdss->lock);
	}

	spin_unlock(&qdss->lock);
	spin_unlock_irqrestore(&channel_lock, flags);
	usb_qdss_free_req(ch);
	spin_lock_irqsave(&channel_lock, flags);