Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Per Forlin <per.forlin@linaro.org>
Cc: "Michał Mirosław" <mirqus@gmail.com>,
	linaro-dev@lists.linaro.org, linux-mmc@vger.kernel.org,
	lkml <linux-kernel@vger.kernel.org>,
	"Stefan Nilsson XK" <stefan.xk.nilsson@stericsson.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] sdio: optimized SDIO IRQ handling for single irq
Date: Wed, 4 May 2011 13:40:56 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.1105041335570.24613@xanadu.home> (raw)
In-Reply-To: <BANLkTinptOJrpdwbLOF_Th-Jz9gKj5Y6dQ@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2040 bytes --]

On Wed, 4 May 2011, Per Forlin wrote:

> 2011/5/4 Michał Mirosław <mirqus@gmail.com>:
> > 2011/5/4 Per Forlin <per.forlin@linaro.org>:
> >> From: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
> >>
> >> If there is only 1 function registered it is possible to
> >> improve performance by directly calling the irq handler
> >> and avoiding the overhead of reading the CCCR registers.
> >>
> > [...]
> >> --- a/drivers/mmc/core/sdio_irq.c
> >> +++ b/drivers/mmc/core/sdio_irq.c
> >> @@ -32,6 +32,16 @@ static int process_sdio_pending_irqs(struct mmc_card *card)
> >>        int i, ret, count;
> >>        unsigned char pending;
> >>
> >> +       /*
> >> +        * Optimization, if there is only 1 function registered
> >> +        * call irq handler directly
> >> +        */
> >> +       if (card->sdio_single_irq && card->sdio_single_irq->irq_handler) {
> >> +               struct sdio_func *func = card->sdio_single_irq;
> >> +               func->irq_handler(func);
> >> +               return 1;
> >> +       }
> > [...]
> >
> > The second condition can be avoided:
> >
> > in process_sdio_pending_irqs():
> >
> > if (card->sdio_irq_func)
> >   call handler and return
> >
> I added the second condition as a sanity check. Same check is used in
> the main for loop
> >	ret = -EINVAL;
> >			} else if (func->irq_handler) {
> >				func->irq_handler(func);
> Is the second check necessary here?

Yes because we want to be notified if the hardware returns pending 
interrupt flags for interrupts we didn't claim.

> > in sdio_claim_irq():
> >
> >  card->func->irq_handler = ...
> >  if (host->sdio_irqs == 1)
> >    card->sdio_irq_func = func;
> >  else
> >    card->sdio_irq_func = NULL;
> I wanted to keep it simple and use same function in claim and release.
> Your code looks nice.
> Is if safe to not check the condition "(card->host->caps &
> MMC_CAP_SDIO_IRQ)". What happens if the SDIO is in polling mode?

You cannot avoid checking MMC_CAP_SDIO_IRQ.  If it isn't set the CCCr 
register must be polled in all cases.


Nicolas

  reply	other threads:[~2011-05-04 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 16:06 [PATCH v2] sdio: optimized SDIO IRQ handling for single irq Per Forlin
2011-05-04 16:06 ` Per Forlin
2011-05-04 16:23   ` Michał Mirosław
2011-05-04 17:00     ` Per Forlin
2011-05-04 17:40       ` Nicolas Pitre [this message]
2011-05-04 17:34   ` Nicolas Pitre
2011-05-04 19:48     ` Per Forlin
2011-05-04 20:22       ` Nicolas Pitre

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=alpine.LFD.2.00.1105041335570.24613@xanadu.home \
    --to=nicolas.pitre@linaro.org \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mirqus@gmail.com \
    --cc=per.forlin@linaro.org \
    --cc=stefan.xk.nilsson@stericsson.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