[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <36b3e42bf80da14782712de5f8c672191dd58073.camel@mediatek.com>
Date: Wed, 29 Dec 2021 17:12:12 +0800
From: Axe Yang <axe.yang@...iatek.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: Ulf Hansson <ulf.hansson@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Chaotian Jing <chaotian.jing@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@...esas.com>,
Satya Tangirala <satyat@...gle.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Lucas Stach <dev@...xeye.de>,
Eric Biggers <ebiggers@...gle.com>,
Andrew Jeffery <andrew@...id.au>,
Stephen Boyd <swboyd@...omium.org>,
Kiwoong Kim <kwmad.kim@...sung.com>,
Yue Hu <huyue2@...ong.com>, Tian Tao <tiantao6@...ilicon.com>,
linux-mmc <linux-mmc@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v1 3/3] mmc: mediatek: add support for SDIO eint irq
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@...iatek.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
Powered by blists - more mailing lists