linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Axe Yang <axe.yang@mediatek.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
	Satya Tangirala <satyat@google.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Lucas Stach <dev@lynxeye.de>, Eric Biggers <ebiggers@google.com>,
	Andrew Jeffery <andrew@aj.id.au>,
	Stephen Boyd <swboyd@chromium.org>,
	Kiwoong Kim <kwmad.kim@samsung.com>, Yue Hu <huyue2@yulong.com>,
	Tian Tao <tiantao6@hisilicon.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v1 3/3] mmc: mediatek: add support for SDIO eint irq
Date: Wed, 29 Dec 2021 17:12:12 +0800	[thread overview]
Message-ID: <36b3e42bf80da14782712de5f8c672191dd58073.camel@mediatek.com> (raw)
In-Reply-To: <CAHp75VcVx4Yf69TEoSy8GL-he9ZAW+yvoH8-DXAotQ3Mwx7n2A@mail.gmail.com>

On Mon, 2021-12-27 at 19:27 +0200, Andy Shevchenko wrote:
> On Mon, Dec 27, 2021 at 6:46 PM Axe Yang <axe.yang@mediatek.com>
> wrote:
> 
> ...
> 
> > +       if (mmc->card && !mmc->card->cccr.enable_async_int) {
> > +               if (enb)
> 
> Spell it fully, i.e. enable.

Will fix it in next version.

> 
> 
> > +                       pm_runtime_get_noresume(host->dev);
> > +               else
> > +                       pm_runtime_put_noidle(host->dev);
> > +       }
> 
> ...
> 
> > +       int ret = 0;
> 
> Redundant assignment, see below.

Will fix it in next version.

> 
> ...
> 
> > +       desc = devm_gpiod_get_index(host->dev, "eint", 0,
> > GPIOD_IN);
> 
> Why _index variant? By default devm_gpiod_get() uses 0 for index.

Will fix it in next version.

> 
> > +       if (IS_ERR(desc))
> > +               return PTR_ERR(desc);
> 
> ...
> 
> > +       irq = gpiod_to_irq(desc);
> 
> ret = ...
> if (ret < 0)
>   ...handle error...

Will fix it in next version.

> 
> > +       if (irq >= 0) {
> 
> (for the record, 0 is never returned by gpiod_to_irq() according to
> all its versions).

Will fix it in next version.

> 
> > +               irq_set_status_flags(irq, IRQ_NOAUTOEN);
> 
> Use corresponding flag:
> 
https://elixir.bootlin.com/linux/latest/source/include/linux/interrupt.h#L83

I think IRQ_NOAUTOEN is the correct parameter I should use:

https://elixir.bootli.com/linux/latest/source/include/linux/irq.h#L800

IRQF_XXX defined in interrupt.h is only for xxx_request_xxx_irq().
Can you confirm that?

> 
> > +               ret = devm_request_threaded_irq(host->dev, irq,
> > NULL, msdc_sdio_eint_irq,
> > +                                               IRQF_TRIGGER_LOW |
> > IRQF_ONESHOT,
> > +                                               "sdio-eint", host);
> > +       } else {
> > +               ret = irq;
> > +       }
> > +
> > +       host->eint_irq = irq;
> 
> Is it okay if you assign garbage here in case of error?

Will refine this part in next version.

> 
> > +       return ret;
> 
> ...
> 
> > +       host->pins_eint = pinctrl_lookup_state(host->pinctrl,
> > "state_eint");
> > +       if (IS_ERR(host->pins_eint)) {
> > +               dev_dbg(&pdev->dev, "Cannot find pinctrl eint!\n");
> > +       } else {
> > +               host->pins_dat1 = pinctrl_lookup_state(host-
> > >pinctrl, "state_dat1");
> > +               if (IS_ERR(host->pins_dat1)) {
> > +                       ret = PTR_ERR(host->pins_dat1);
> > +                       dev_err(&pdev->dev, "Cannot find pinctrl
> > dat1!\n");
> 
> ret = dev_err_probe(...); ?

Will fix it in next version.

> 
> > +                       goto host_free;
> > +               }
> > +       }
> 
> ...
> 
> > +       if (!IS_ERR(host->pins_eint)) {
> 
> I'm wondering if you can use a pattern "error check first"?

The intention of this line is to determine whether current mmc device
is a SDIO card which supports eint, not for error check. But, since it
may bring ambiguity, I will implement it in another way. Thanks for
your advice.

...

--
Regards,
Axe Yang

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2021-12-29  9:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27  8:36 [PATCH v1 0/3] mmc: mediatek: add support for SDIO async int Axe Yang
2021-12-27  8:36 ` [PATCH v1 1/3] dt-bindings: mmc: add cap-sdio-async-int flag Axe Yang
2022-01-04 22:33   ` Rob Herring
2022-01-07  8:19     ` Axe Yang
2021-12-27  8:36 ` [PATCH v1 2/3] mmc: core: Add support for SDIO async interrupt Axe Yang
2022-01-04 10:23   ` AngeloGioacchino Del Regno
2021-12-27  8:36 ` [PATCH v1 3/3] mmc: mediatek: add support for SDIO eint irq Axe Yang
2021-12-27 17:27   ` Andy Shevchenko
2021-12-29  9:12     ` Axe Yang [this message]
2022-01-04 10:44   ` AngeloGioacchino Del Regno
2022-01-07  7:53     ` Axe Yang

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=36b3e42bf80da14782712de5f8c672191dd58073.camel@mediatek.com \
    --to=axe.yang@mediatek.com \
    --cc=adrian.hunter@intel.com \
    --cc=andrew@aj.id.au \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=dev@lynxeye.de \
    --cc=devicetree@vger.kernel.org \
    --cc=ebiggers@google.com \
    --cc=huyue2@yulong.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=satyat@google.com \
    --cc=swboyd@chromium.org \
    --cc=tiantao6@hisilicon.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yoshihiro.shimoda.uh@renesas.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;
as well as URLs for NNTP newsgroup(s).