From: Grant Likely <grant.likely@secretlab.ca>
To: Christian Pellegrin <chripell@fsfe.org>
Cc: feng.tang@intel.com, akpm@linux-foundation.org, greg@kroah.com,
david-b@pacbell.net, alan@lxorguk.ukuu.org.uk,
spi-devel-general@lists.sourceforge.net,
linux-serial@vger.kernel.org
Subject: Re: [PATCH 2/3] max3100: moved to threaded interrupt
Date: Fri, 19 Mar 2010 11:58:20 -0600 [thread overview]
Message-ID: <fa686aa41003191058o20e1c9cakb9684275bee78ca4@mail.gmail.com> (raw)
In-Reply-To: <1268987973-22719-1-git-send-email-chripell@fsfe.org>
On Fri, Mar 19, 2010 at 2:39 AM, Christian Pellegrin <chripell@fsfe.org> wrote:
> The driver was reworked to use threaded interrupts instead of workqueus.
> This is a major boost in performance because the former are scheduled as
> SCHED_FIFO processes. As a side effect suspend/resume code was greatly
> simplified.
>
> Signed-off-by: Christian Pellegrin <chripell@fsfe.org>
On a quick parse, it seems mostly okay. I haven't dug into the driver
execution flow though. A few minor comments below.
> ---
> drivers/serial/max3100.c | 102 ++++++++++++++-------------------------------
> 1 files changed, 32 insertions(+), 70 deletions(-)
>
> diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
> index 3c30c56..0c972c6 100644
> --- a/drivers/serial/max3100.c
> +++ b/drivers/serial/max3100.c
> @@ -45,7 +45,9 @@
> #include <linux/serial_core.h>
> #include <linux/serial.h>
> #include <linux/spi/spi.h>
> -#include <linux/freezer.h>
> +#include <linux/kthread.h>
> +#include <linux/interrupt.h>
> +#include <linux/bitops.h>
>
> #include <linux/serial_max3100.h>
>
> @@ -113,18 +115,15 @@ struct max3100_port {
>
> int irq; /* irq assigned to the max3100 */
>
> + /* the workqueue is needed because we cannot schedule
> + a threaded interrupt during PM
> + */
> + struct work_struct resume_work;
> +
> int minor; /* minor number */
> int crystal; /* 1 if 3.6864Mhz crystal 0 for 1.8432 */
> int loopback; /* 1 if we are in loopback mode */
>
> - /* for handling irqs: need workqueue since we do spi_sync */
> - struct workqueue_struct *workqueue;
> - struct work_struct work;
> - /* set to 1 to make the workhandler exit as soon as possible */
> - int force_end_work;
> - /* need to know we are suspending to avoid deadlock on workqueue */
> - int suspending;
> -
> /* hook for suspending MAX3100 via dedicated pin */
> void (*max3100_hw_suspend) (int suspend);
>
> @@ -171,13 +170,12 @@ static void max3100_calc_parity(struct max3100_port *s, u16 *c)
> *c |= max3100_do_parity(s, *c) << 8;
> }
>
> -static void max3100_work(struct work_struct *w);
> -
> -static void max3100_dowork(struct max3100_port *s)
> +static void max3100_resume_work(struct work_struct *w)
> {
> - if (!s->force_end_work && !work_pending(&s->work) &&
> - !freezing(current) && !s->suspending)
> - queue_work(s->workqueue, &s->work);
> + struct max3100_port *s = container_of(w, struct max3100_port,
> + resume_work);
container_of is used a lot. Maybe consider a follow-on patch to
create a to_max3100_port() static inline.
> +
> + raise_threaded_irq(s->irq);
> }
>
> static void max3100_timeout(unsigned long data)
> @@ -185,7 +183,7 @@ static void max3100_timeout(unsigned long data)
> struct max3100_port *s = (struct max3100_port *)data;
>
> if (s->port.state) {
> - max3100_dowork(s);
> + raise_threaded_irq(s->irq);
> mod_timer(&s->timer, jiffies + s->poll_time);
> }
> }
> @@ -255,9 +253,9 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx)
> return ret;
> }
>
> -static void max3100_work(struct work_struct *w)
> +static irqreturn_t max3100_ist(int irq, void *dev_id)
'ist'?
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-03-19 17:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cabda6421003190139h344bc172h3556fca78e4b25cb@mail.gmail.com>
2010-03-19 8:38 ` [PATCH 1/3] max3100: added raise_threaded_irq Christian Pellegrin
2010-03-19 8:39 ` [PATCH 2/3] max3100: moved to threaded interrupt Christian Pellegrin
2010-03-19 8:39 ` [PATCH 3/3] max3100: adds console support for MAX3100 Christian Pellegrin
[not found] ` <1268987934-22690-1-git-send-email-chripell@fsfe.org>
2010-03-19 17:48 ` [PATCH 1/3] max3100: added raise_threaded_irq Grant Likely
2010-03-21 7:31 ` christian pellegrin
[not found] ` <1268987973-22719-1-git-send-email-chripell@fsfe.org>
2010-03-19 17:58 ` Grant Likely [this message]
2010-03-21 7:34 ` [PATCH 2/3] max3100: moved to threaded interrupt christian pellegrin
[not found] ` <1268987997-22746-1-git-send-email-chripell@fsfe.org>
2010-03-19 19:31 ` [PATCH 3/3] max3100: adds console support for MAX3100 Grant Likely
2010-03-21 7:47 ` christian pellegrin
[not found] ` <cabda6421003210047i1d4545aasf8969bb70d48ceb9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-21 16:28 ` David Brownell
2010-03-22 1:31 ` Feng Tang
2010-03-22 7:03 ` christian pellegrin
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=fa686aa41003191058o20e1c9cakb9684275bee78ca4@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=chripell@fsfe.org \
--cc=david-b@pacbell.net \
--cc=feng.tang@intel.com \
--cc=greg@kroah.com \
--cc=linux-serial@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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).