aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArvid Brodin <arvid.brodin@enea.com>2011-05-19 18:17:34 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-19 19:34:04 -0400
commit079cdb0947ce6ae7df0c73a1c82c14920a9b6b6d (patch)
treede0a18dca25e9b42a1ec3afa26a5ae963e5b6632
parent69fff59de4d844f8b4c2454c3c23d32b69dcbfd7 (diff)
usb/isp1760: Move function isp1760_endpoint_disable() within file.
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@enea.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/host/isp1760-hcd.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index dd98a966b58b..485fc70625a1 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -1558,6 +1558,40 @@ out:
1558 return retval; 1558 return retval;
1559} 1559}
1560 1560
1561static void isp1760_endpoint_disable(struct usb_hcd *hcd,
1562 struct usb_host_endpoint *ep)
1563{
1564 struct isp1760_hcd *priv = hcd_to_priv(hcd);
1565 struct isp1760_qh *qh;
1566 struct isp1760_qtd *qtd;
1567 unsigned long spinflags;
1568 int do_iter;
1569
1570 spin_lock_irqsave(&priv->lock, spinflags);
1571 qh = ep->hcpriv;
1572 if (!qh)
1573 goto out;
1574
1575 do_iter = !list_empty(&qh->qtd_list);
1576 while (do_iter) {
1577 do_iter = 0;
1578 list_for_each_entry(qtd, &qh->qtd_list, qtd_list) {
1579 if (qtd->urb->ep == ep) {
1580 spin_unlock_irqrestore(&priv->lock, spinflags);
1581 isp1760_urb_dequeue(hcd, qtd->urb, -ECONNRESET);
1582 spin_lock_irqsave(&priv->lock, spinflags);
1583 do_iter = 1;
1584 break; /* Restart iteration */
1585 }
1586 }
1587 }
1588 ep->hcpriv = NULL;
1589 /* Cannot free qh here since it will be parsed by schedule_ptds() */
1590
1591out:
1592 spin_unlock_irqrestore(&priv->lock, spinflags);
1593}
1594
1561static int isp1760_hub_status_data(struct usb_hcd *hcd, char *buf) 1595static int isp1760_hub_status_data(struct usb_hcd *hcd, char *buf)
1562{ 1596{
1563 struct isp1760_hcd *priv = hcd_to_priv(hcd); 1597 struct isp1760_hcd *priv = hcd_to_priv(hcd);
@@ -1927,40 +1961,6 @@ error:
1927 return retval; 1961 return retval;
1928} 1962}
1929 1963
1930static void isp1760_endpoint_disable(struct usb_hcd *hcd,
1931 struct usb_host_endpoint *ep)
1932{
1933 struct isp1760_hcd *priv = hcd_to_priv(hcd);
1934 struct isp1760_qh *qh;
1935 struct isp1760_qtd *qtd;
1936 unsigned long spinflags;
1937 int do_iter;
1938
1939 spin_lock_irqsave(&priv->lock, spinflags);
1940 qh = ep->hcpriv;
1941 if (!qh)
1942 goto out;
1943
1944 do_iter = !list_empty(&qh->qtd_list);
1945 while (do_iter) {
1946 do_iter = 0;
1947 list_for_each_entry(qtd, &qh->qtd_list, qtd_list) {
1948 if (qtd->urb->ep == ep) {
1949 spin_unlock_irqrestore(&priv->lock, spinflags);
1950 isp1760_urb_dequeue(hcd, qtd->urb, -ECONNRESET);
1951 spin_lock_irqsave(&priv->lock, spinflags);
1952 do_iter = 1;
1953 break; /* Restart iteration */
1954 }
1955 }
1956 }
1957 ep->hcpriv = NULL;
1958 /* Cannot free qh here since it will be parsed by schedule_ptds() */
1959
1960out:
1961 spin_unlock_irqrestore(&priv->lock, spinflags);
1962}
1963
1964static int isp1760_get_frame(struct usb_hcd *hcd) 1964static int isp1760_get_frame(struct usb_hcd *hcd)
1965{ 1965{
1966 struct isp1760_hcd *priv = hcd_to_priv(hcd); 1966 struct isp1760_hcd *priv = hcd_to_priv(hcd);