From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Felipe Balbi <balbi@kernel.org>, Vladimir Zapolskiy <vz@mleia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sylvain Lemieux <slemieux.tyco@gmail.com>,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: [PATCH 2/5] usb: gadget: udc: lpc32xx: simplify vbus handling
Date: Tue, 9 Apr 2019 14:09:05 +0200 [thread overview]
Message-ID: <20190409120908.12079-3-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20190409120908.12079-1-alexandre.belloni@bootlin.com>
Use a threaded IRQ to handle vbus_work instead of using the global
worqueue.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/usb/gadget/udc/lpc32xx_udc.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
index 5546cb509085..777279fa4637 100644
--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
@@ -152,7 +152,6 @@ struct lpc32xx_udc {
/* Work queues related to I2C support */
struct work_struct pullup_job;
- struct work_struct vbus_job;
struct work_struct power_job;
/* USB device peripheral - various */
@@ -2828,11 +2827,9 @@ static irqreturn_t lpc32xx_usb_devdma_irq(int irq, void *_udc)
* VBUS detection, pullup handler, and Gadget cable state notification
*
*/
-static void vbus_work(struct work_struct *work)
+static void vbus_work(struct lpc32xx_udc *udc)
{
u8 value;
- struct lpc32xx_udc *udc = container_of(work, struct lpc32xx_udc,
- vbus_job);
if (udc->enabled != 0) {
/* Discharge VBUS real quick */
@@ -2877,9 +2874,7 @@ static irqreturn_t lpc32xx_usb_vbus_irq(int irq, void *_udc)
{
struct lpc32xx_udc *udc = _udc;
- /* Defer handling of VBUS IRQ to work queue */
- disable_irq_nosync(udc->udp_irq[IRQ_USB_ATX]);
- schedule_work(&udc->vbus_job);
+ vbus_work(udc);
return IRQ_HANDLED;
}
@@ -2908,7 +2903,7 @@ static int lpc32xx_start(struct usb_gadget *gadget,
/* Force VBUS process once to check for cable insertion */
udc->last_vbus = udc->vbus = 0;
- schedule_work(&udc->vbus_job);
+ vbus_work(udc);
/* Do not re-enable ATX IRQ (3) */
for (i = IRQ_USB_LP; i < IRQ_USB_ATX; i++)
@@ -3080,7 +3075,6 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
/* Setup deferred workqueue data */
udc->poweron = udc->pullup = 0;
INIT_WORK(&udc->pullup_job, pullup_work);
- INIT_WORK(&udc->vbus_job, vbus_work);
#ifdef CONFIG_PM
INIT_WORK(&udc->power_job, power_work);
#endif
@@ -3143,8 +3137,9 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
/* The transceiver interrupt is used for VBUS detection and will
kick off the VBUS handler function */
- retval = devm_request_irq(dev, udc->udp_irq[IRQ_USB_ATX],
- lpc32xx_usb_vbus_irq, 0, "udc_otg", udc);
+ retval = devm_request_threaded_irq(dev, udc->udp_irq[IRQ_USB_ATX], NULL,
+ lpc32xx_usb_vbus_irq, IRQF_ONESHOT,
+ "udc_otg", udc);
if (retval < 0) {
dev_err(udc->dev, "VBUS request irq %d failed\n",
udc->udp_irq[IRQ_USB_ATX]);
--
2.20.1
next prev parent reply other threads:[~2019-04-09 12:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 12:09 [PATCH 0/5] usb: gadget: udc: lpc32xx: add stotg04 phy support Alexandre Belloni
2019-04-09 12:09 ` [PATCH 1/5] usb: gadget: udc: lpc32xx: simplify probe Alexandre Belloni
2019-04-09 12:09 ` Alexandre Belloni [this message]
2019-04-09 12:09 ` [PATCH 3/5] usb: gadget: udc: lpc32xx: properly setup phy interrupts Alexandre Belloni
2019-04-09 12:09 ` [PATCH 4/5] usb: gadget: udc: lpc32xx: add support for stotg04 phy Alexandre Belloni
2019-04-09 12:09 ` [PATCH 5/5] usb: gadget: udc: lpc32xx: rework interrupt handling Alexandre Belloni
2019-05-13 11:32 ` [PATCH 0/5] usb: gadget: udc: lpc32xx: add stotg04 phy support James Grant
2019-05-22 15:00 ` Sylvain Lemieux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190409120908.12079-3-alexandre.belloni@bootlin.com \
--to=alexandre.belloni@bootlin.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=slemieux.tyco@gmail.com \
--cc=vz@mleia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome