[PATCH 197/205] usb/isp1760: Move function isp1760_endpoint_disable() within file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Arvid Brodin <arvid.brodin@xxxxxxxx>

Preparation for patch #2. The function isp1760_endpoint_disable() does almost
the same thing as urb_dequeue(). In patch #2 I change these to use a common
helper function instead of calling each other - for clarity but also to
avoid releasing the spinlock while in a "questionable" state. It seemed
proper to have these functions close to each other in the code.

Signed-off-by: Arvid Brodin <arvid.brodin@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/usb/host/isp1760-hcd.c |   68 ++++++++++++++++++++--------------------
 1 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index dd98a96..485fc70 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -1558,6 +1558,40 @@ out:
 	return retval;
 }
 
+static void isp1760_endpoint_disable(struct usb_hcd *hcd,
+		struct usb_host_endpoint *ep)
+{
+	struct isp1760_hcd *priv = hcd_to_priv(hcd);
+	struct isp1760_qh *qh;
+	struct isp1760_qtd *qtd;
+	unsigned long spinflags;
+	int do_iter;
+
+	spin_lock_irqsave(&priv->lock, spinflags);
+	qh = ep->hcpriv;
+	if (!qh)
+		goto out;
+
+	do_iter = !list_empty(&qh->qtd_list);
+	while (do_iter) {
+		do_iter = 0;
+		list_for_each_entry(qtd, &qh->qtd_list, qtd_list) {
+			if (qtd->urb->ep == ep) {
+				spin_unlock_irqrestore(&priv->lock, spinflags);
+				isp1760_urb_dequeue(hcd, qtd->urb, -ECONNRESET);
+				spin_lock_irqsave(&priv->lock, spinflags);
+				do_iter = 1;
+				break; /* Restart iteration */
+			}
+		}
+	}
+	ep->hcpriv = NULL;
+	/* Cannot free qh here since it will be parsed by schedule_ptds() */
+
+out:
+	spin_unlock_irqrestore(&priv->lock, spinflags);
+}
+
 static int isp1760_hub_status_data(struct usb_hcd *hcd, char *buf)
 {
 	struct isp1760_hcd *priv = hcd_to_priv(hcd);
@@ -1927,40 +1961,6 @@ error:
 	return retval;
 }
 
-static void isp1760_endpoint_disable(struct usb_hcd *hcd,
-		struct usb_host_endpoint *ep)
-{
-	struct isp1760_hcd *priv = hcd_to_priv(hcd);
-	struct isp1760_qh *qh;
-	struct isp1760_qtd *qtd;
-	unsigned long spinflags;
-	int do_iter;
-
-	spin_lock_irqsave(&priv->lock, spinflags);
-	qh = ep->hcpriv;
-	if (!qh)
-		goto out;
-
-	do_iter = !list_empty(&qh->qtd_list);
-	while (do_iter) {
-		do_iter = 0;
-		list_for_each_entry(qtd, &qh->qtd_list, qtd_list) {
-			if (qtd->urb->ep == ep) {
-				spin_unlock_irqrestore(&priv->lock, spinflags);
-				isp1760_urb_dequeue(hcd, qtd->urb, -ECONNRESET);
-				spin_lock_irqsave(&priv->lock, spinflags);
-				do_iter = 1;
-				break; /* Restart iteration */
-			}
-		}
-	}
-	ep->hcpriv = NULL;
-	/* Cannot free qh here since it will be parsed by schedule_ptds() */
-
-out:
-	spin_unlock_irqrestore(&priv->lock, spinflags);
-}
-
 static int isp1760_get_frame(struct usb_hcd *hcd)
 {
 	struct isp1760_hcd *priv = hcd_to_priv(hcd);
-- 
1.7.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux