From: Daniel Mack <daniel@zonque.org>
To: devicetree@vger.kernel.org, linux-serial@vger.kernel.org
Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org, jslaby@suse.com,
jringle@gridpoint.com, m.brock@vanmierlo.com,
pascal.huerst@gmail.com, Daniel Mack <daniel@zonque.org>
Subject: [PATCH v2 4/6] sc16is7xx: Use threaded IRQ
Date: Tue, 19 May 2020 20:21:45 +0200 [thread overview]
Message-ID: <20200519182147.218713-5-daniel@zonque.org> (raw)
In-Reply-To: <20200519182147.218713-1-daniel@zonque.org>
Use a threaded IRQ handler to get rid of the irq_work kthread.
This also allows for the driver to use interrupts generated by
a threaded controller.
Signed-off-by: Daniel Mack <daniel@zonque.org>
---
drivers/tty/serial/sc16is7xx.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index fcb2551a5df2..cebc0cf9c30e 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -328,7 +328,6 @@ struct sc16is7xx_port {
unsigned char buf[SC16IS7XX_FIFO_SIZE];
struct kthread_worker kworker;
struct task_struct *kworker_task;
- struct kthread_work irq_work;
struct mutex efr_lock;
struct sc16is7xx_one p[0];
};
@@ -711,9 +710,9 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
return true;
}
-static void sc16is7xx_ist(struct kthread_work *ws)
+static irqreturn_t sc16is7xx_irq(int irq, void *dev_id)
{
- struct sc16is7xx_port *s = to_sc16is7xx_port(ws, irq_work);
+ struct sc16is7xx_port *s = (struct sc16is7xx_port *)dev_id;
mutex_lock(&s->efr_lock);
@@ -728,13 +727,6 @@ static void sc16is7xx_ist(struct kthread_work *ws)
}
mutex_unlock(&s->efr_lock);
-}
-
-static irqreturn_t sc16is7xx_irq(int irq, void *dev_id)
-{
- struct sc16is7xx_port *s = (struct sc16is7xx_port *)dev_id;
-
- kthread_queue_work(&s->kworker, &s->irq_work);
return IRQ_HANDLED;
}
@@ -1230,7 +1222,6 @@ static int sc16is7xx_probe(struct device *dev,
mutex_init(&s->efr_lock);
kthread_init_worker(&s->kworker);
- kthread_init_work(&s->irq_work, sc16is7xx_ist);
s->kworker_task = kthread_run(kthread_worker_fn, &s->kworker,
"sc16is7xx");
if (IS_ERR(s->kworker_task)) {
@@ -1323,8 +1314,9 @@ static int sc16is7xx_probe(struct device *dev,
}
/* Setup interrupt */
- ret = devm_request_irq(dev, irq, sc16is7xx_irq,
- IRQF_TRIGGER_FALLING, dev_name(dev), s);
+ ret = devm_request_threaded_irq(dev, irq, NULL, sc16is7xx_irq,
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ dev_name(dev), s);
if (!ret)
return 0;
--
2.26.2
next prev parent reply other threads:[~2020-05-19 18:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 18:21 [PATCH v2 0/6] sc16is7xx: IrDA mode and threaded IRQs Daniel Mack
2020-05-19 18:21 ` [PATCH v2 1/6] dt-bindings: sc16is7xx: Add flag to activate IrDA mode Daniel Mack
2020-05-19 18:21 ` [PATCH v2 2/6] " Daniel Mack
2020-05-21 8:43 ` Greg KH
2020-05-19 18:21 ` [PATCH v2 3/6] sc16is7xx: Always use falling edge IRQ Daniel Mack
2020-05-19 18:21 ` Daniel Mack [this message]
2020-05-19 18:21 ` [PATCH v2 5/6] sc16is7xx: Allow sharing the IRQ line Daniel Mack
2020-05-19 18:21 ` [PATCH v2 6/6] sc16is7xx: Read the LSR register for basic device presence check Daniel Mack
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=20200519182147.218713-5-daniel@zonque.org \
--to=daniel@zonque.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jringle@gridpoint.com \
--cc=jslaby@suse.com \
--cc=linux-serial@vger.kernel.org \
--cc=m.brock@vanmierlo.com \
--cc=pascal.huerst@gmail.com \
--cc=robh+dt@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).