Thread (11 messages) 11 messages, 4 authors, 2022-01-07

Re: [PATCH v1 3/3] mmc: mediatek: add support for SDIO eint irq

From: Axe Yang <hidden>
Date: 2021-12-29 09:12:23
Also in: linux-arm-kernel, linux-devicetree, linux-mmc, lkml

On Mon, 2021-12-27 at 19:27 +0200, Andy Shevchenko wrote:
On Mon, Dec 27, 2021 at 6:46 PM Axe Yang [off-list ref]
wrote:

...
quoted
+       if (mmc->card && !mmc->card->cccr.enable_async_int) {
+               if (enb)
Spell it fully, i.e. enable.
Will fix it in next version.
quoted
+                       pm_runtime_get_noresume(host->dev);
+               else
+                       pm_runtime_put_noidle(host->dev);
+       }
...
quoted
+       int ret = 0;
Redundant assignment, see below.
Will fix it in next version.
...
quoted
+       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.
quoted
+       if (IS_ERR(desc))
+               return PTR_ERR(desc);
...
quoted
+       irq = gpiod_to_irq(desc);
ret = ...
if (ret < 0)
  ...handle error...
Will fix it in next version.
quoted
+       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.
quoted
+               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?
quoted
+               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.
quoted
+       return ret;
...
quoted
+       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-
quoted
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.
quoted
+                       goto host_free;
+               }
+       }
...
quoted
+       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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help