aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-06-27 03:00:18 -0400
committerFelipe Balbi <balbi@ti.com>2013-07-29 06:56:39 -0400
commitb0d7ffd44ba9cd2dfbf299674418193a5f9ed21a (patch)
treef94aa3f515255204fab472d80814e1fd8ead1d1e /drivers/usb/dwc3
parent2b0c49530bc5fdbde93295e5c8f26f55d0de1e04 (diff)
usb: dwc3: gadget: don't request IRQs in atomic
We cannot request an IRQ with spinlocks held as that would trigger a sleeping inside spinlock warning. Cc: <stable@vger.kernel.org> # v3.10 Reported-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index f77083fedc68..14d28d6184f6 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1508,6 +1508,15 @@ static int dwc3_gadget_start(struct usb_gadget *g,
1508 int irq; 1508 int irq;
1509 u32 reg; 1509 u32 reg;
1510 1510
1511 irq = platform_get_irq(to_platform_device(dwc->dev), 0);
1512 ret = request_threaded_irq(irq, dwc3_interrupt, dwc3_thread_interrupt,
1513 IRQF_SHARED | IRQF_ONESHOT, "dwc3", dwc);
1514 if (ret) {
1515 dev_err(dwc->dev, "failed to request irq #%d --> %d\n",
1516 irq, ret);
1517 goto err0;
1518 }
1519
1511 spin_lock_irqsave(&dwc->lock, flags); 1520 spin_lock_irqsave(&dwc->lock, flags);
1512 1521
1513 if (dwc->gadget_driver) { 1522 if (dwc->gadget_driver) {
@@ -1515,7 +1524,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
1515 dwc->gadget.name, 1524 dwc->gadget.name,
1516 dwc->gadget_driver->driver.name); 1525 dwc->gadget_driver->driver.name);
1517 ret = -EBUSY; 1526 ret = -EBUSY;
1518 goto err0; 1527 goto err1;
1519 } 1528 }
1520 1529
1521 dwc->gadget_driver = driver; 1530 dwc->gadget_driver = driver;
@@ -1551,42 +1560,38 @@ static int dwc3_gadget_start(struct usb_gadget *g,
1551 ret = __dwc3_gadget_ep_enable(dep, &dwc3_gadget_ep0_desc, NULL, false); 1560 ret = __dwc3_gadget_ep_enable(dep, &dwc3_gadget_ep0_desc, NULL, false);
1552 if (ret) { 1561 if (ret) {
1553 dev_err(dwc->dev, "failed to enable %s\n", dep->name); 1562 dev_err(dwc->dev, "failed to enable %s\n", dep->name);
1554 goto err0; 1563 goto err2;
1555 } 1564 }
1556 1565
1557 dep = dwc->eps[1]; 1566 dep = dwc->eps[1];
1558 ret = __dwc3_gadget_ep_enable(dep, &dwc3_gadget_ep0_desc, NULL, false); 1567 ret = __dwc3_gadget_ep_enable(dep, &dwc3_gadget_ep0_desc, NULL, false);
1559 if (ret) { 1568 if (ret) {
1560 dev_err(dwc->dev, "failed to enable %s\n", dep->name); 1569 dev_err(dwc->dev, "failed to enable %s\n", dep->name);
1561 goto err1; 1570 goto err3;
1562 } 1571 }
1563 1572
1564 /* begin to receive SETUP packets */ 1573 /* begin to receive SETUP packets */
1565 dwc->ep0state = EP0_SETUP_PHASE; 1574 dwc->ep0state = EP0_SETUP_PHASE;
1566 dwc3_ep0_out_start(dwc); 1575 dwc3_ep0_out_start(dwc);
1567 1576
1568 irq = platform_get_irq(to_platform_device(dwc->dev), 0);
1569 ret = request_threaded_irq(irq, dwc3_interrupt, dwc3_thread_interrupt,
1570 IRQF_SHARED | IRQF_ONESHOT, "dwc3", dwc);
1571 if (ret) {
1572 dev_err(dwc->dev, "failed to request irq #%d --> %d\n",
1573 irq, ret);
1574 goto err1;
1575 }
1576
1577 dwc3_gadget_enable_irq(dwc); 1577 dwc3_gadget_enable_irq(dwc);
1578 1578
1579 spin_unlock_irqrestore(&dwc->lock, flags); 1579 spin_unlock_irqrestore(&dwc->lock, flags);
1580 1580
1581 return 0; 1581 return 0;
1582 1582
1583err1: 1583err3:
1584 __dwc3_gadget_ep_disable(dwc->eps[0]); 1584 __dwc3_gadget_ep_disable(dwc->eps[0]);
1585 1585
1586err0: 1586err2:
1587 dwc->gadget_driver = NULL; 1587 dwc->gadget_driver = NULL;
1588
1589err1:
1588 spin_unlock_irqrestore(&dwc->lock, flags); 1590 spin_unlock_irqrestore(&dwc->lock, flags);
1589 1591
1592 free_irq(irq, dwc);
1593
1594err0:
1590 return ret; 1595 return ret;
1591} 1596}
1592 1597
@@ -1600,9 +1605,6 @@ static int dwc3_gadget_stop(struct usb_gadget *g,
1600 spin_lock_irqsave(&dwc->lock, flags); 1605 spin_lock_irqsave(&dwc->lock, flags);
1601 1606
1602 dwc3_gadget_disable_irq(dwc); 1607 dwc3_gadget_disable_irq(dwc);
1603 irq = platform_get_irq(to_platform_device(dwc->dev), 0);
1604 free_irq(irq, dwc);
1605
1606 __dwc3_gadget_ep_disable(dwc->eps[0]); 1608 __dwc3_gadget_ep_disable(dwc->eps[0]);
1607 __dwc3_gadget_ep_disable(dwc->eps[1]); 1609 __dwc3_gadget_ep_disable(dwc->eps[1]);
1608 1610
@@ -1610,6 +1612,9 @@ static int dwc3_gadget_stop(struct usb_gadget *g,
1610 1612
1611 spin_unlock_irqrestore(&dwc->lock, flags); 1613 spin_unlock_irqrestore(&dwc->lock, flags);
1612 1614
1615 irq = platform_get_irq(to_platform_device(dwc->dev), 0);
1616 free_irq(irq, dwc);
1617
1613 return 0; 1618 return 0;
1614} 1619}
1615 1620