All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Douglas Anderson <dianders@chromium.org>
Subject: Re: [PATCH 1/2] mmc: sdio: Move code to get pending SDIO IRQs to a function
Date: Thu, 29 Aug 2019 10:25:04 -0700	[thread overview]
Message-ID: <20190829172504.GE70797@google.com> (raw)
In-Reply-To: <CAPDyKFrJOXC5DaYzPrEr-ttv5Mz6NLAvVW+L4xUUaiZpqyj+Dw@mail.gmail.com>

On Thu, Aug 29, 2019 at 10:29:26AM +0200, Ulf Hansson wrote:
> On Wed, 28 Aug 2019 at 23:46, Matthias Kaehlcke <mka@chromium.org> wrote:
> >
> > Move the code to get pending SDIO interrupts from
> > process_sdio_pending_irqs() to a dedicated function.
> >
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > ---
> >  drivers/mmc/core/sdio_irq.c | 47 ++++++++++++++++++++++++-------------
> >  include/linux/mmc/host.h    |  1 +
> >  2 files changed, 32 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
> > index 0bcc5e83bd1a..fedc49901efd 100644
> > --- a/drivers/mmc/core/sdio_irq.c
> > +++ b/drivers/mmc/core/sdio_irq.c
> > @@ -27,6 +27,35 @@
> >  #include "core.h"
> >  #include "card.h"
> >
> > +int sdio_get_pending_irqs(struct mmc_host *host, u8 *pending)
> > +{
> > +       struct mmc_card *card = host->card;
> > +       int ret;
> > +
> > +       WARN_ON(!host->claimed);
> > +
> > +       ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, pending);
> > +       if (ret) {
> > +               pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
> > +                      mmc_card_id(card), ret);
> > +               return ret;
> > +       }
> > +
> > +       if (*pending && mmc_card_broken_irq_polling(card) &&
> > +           !(host->caps & MMC_CAP_SDIO_IRQ)) {
> > +               unsigned char dummy;
> > +
> > +               /* A fake interrupt could be created when we poll SDIO_CCCR_INTx
> > +                * register with a Marvell SD8797 card. A dummy CMD52 read to
> > +                * function 0 register 0xff can avoid this.
> > +                */
> > +               mmc_io_rw_direct(card, 0, 0, 0xff, 0, &dummy);
> > +       }
> > +
> > +       return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(sdio_get_pending_irqs);
> 
> I don't think you need export the sympol as this should be an internal
> function for the core module.

ok, thanks

> > +
> >  static int process_sdio_pending_irqs(struct mmc_host *host)
> >  {
> >         struct mmc_card *card = host->card;
> > @@ -49,23 +78,9 @@ static int process_sdio_pending_irqs(struct mmc_host *host)
> >                 return 1;
> >         }
> >
> > -       ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending);
> > -       if (ret) {
> > -               pr_debug("%s: error %d reading SDIO_CCCR_INTx\n",
> > -                      mmc_card_id(card), ret);
> > +       ret = sdio_get_pending_irqs(host, &pending);
> > +       if (ret)
> >                 return ret;
> > -       }
> > -
> > -       if (pending && mmc_card_broken_irq_polling(card) &&
> > -           !(host->caps & MMC_CAP_SDIO_IRQ)) {
> > -               unsigned char dummy;
> > -
> > -               /* A fake interrupt could be created when we poll SDIO_CCCR_INTx
> > -                * register with a Marvell SD8797 card. A dummy CMD52 read to
> > -                * function 0 register 0xff can avoid this.
> > -                */
> > -               mmc_io_rw_direct(card, 0, 0, 0xff, 0, &dummy);
> > -       }
> >
> >         count = 0;
> >         for (i = 1; i <= 7; i++) {
> > diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> > index 4a351cb7f20f..7ce0e98e3dbd 100644
> > --- a/include/linux/mmc/host.h
> > +++ b/include/linux/mmc/host.h
> > @@ -502,6 +502,7 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
> >  }
> >
> >  void sdio_signal_irq(struct mmc_host *host);
> > +int sdio_get_pending_irqs(struct mmc_host *host, u8 *pending);
> 
> I want to avoid to sprinkle the public mmc headers, avoiding
> interfaces to be abused outside mmc core.
> 
> That said, I think this should be internal to the mmc core, thus
> please move this to drivers/mmc/core/sdio_ops.h.

Sounds good

      reply	other threads:[~2019-08-29 17:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 21:46 [PATCH 1/2] mmc: sdio: Move code to get pending SDIO IRQs to a function Matthias Kaehlcke
2019-08-28 21:46 ` [PATCH 2/2] mmc: core: Run handlers for pending SDIO interrupts on resume Matthias Kaehlcke
2019-08-29  8:48   ` Ulf Hansson
2019-08-29 17:15     ` Matthias Kaehlcke
2019-08-29 17:39       ` Doug Anderson
2019-08-30  6:08         ` Ulf Hansson
2019-08-30 10:38           ` Ulf Hansson
2019-08-29 17:44   ` Doug Anderson
2019-08-29  8:29 ` [PATCH 1/2] mmc: sdio: Move code to get pending SDIO IRQs to a function Ulf Hansson
2019-08-29 17:25   ` Matthias Kaehlcke [this message]

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=20190829172504.GE70797@google.com \
    --to=mka@chromium.org \
    --cc=dianders@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.