lkml.org 
[lkml]   [2021]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1 3/3] mmc: mediatek: add support for SDIO eint irq
From
Date
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

\
 
 \ /
  Last update: 2021-12-29 10:13    [W:0.138 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site