[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcVx4Yf69TEoSy8GL-he9ZAW+yvoH8-DXAotQ3Mwx7n2A@mail.gmail.com>
Date: Mon, 27 Dec 2021 19:27:53 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Axe Yang <axe.yang@...iatek.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, 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.
> + pm_runtime_get_noresume(host->dev);
> + else
> + pm_runtime_put_noidle(host->dev);
> + }
...
> + int ret = 0;
Redundant assignment, see below.
...
> + desc = devm_gpiod_get_index(host->dev, "eint", 0, GPIOD_IN);
Why _index variant? By default devm_gpiod_get() uses 0 for index.
> + if (IS_ERR(desc))
> + return PTR_ERR(desc);
...
> + irq = gpiod_to_irq(desc);
ret = ...
if (ret < 0)
...handle error...
> + if (irq >= 0) {
(for the record, 0 is never returned by gpiod_to_irq() according to
all its versions).
> + irq_set_status_flags(irq, IRQ_NOAUTOEN);
Use corresponding flag:
https://elixir.bootlin.com/linux/latest/source/include/linux/interrupt.h#L83
> + 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?
> + 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(...); ?
> + goto host_free;
> + }
> + }
...
> + if (!IS_ERR(host->pins_eint)) {
I'm wondering if you can use a pattern "error check first"?
> + disable_irq(host->irq);
> + pinctrl_select_state(host->pinctrl, host->pins_eint);
> + spin_lock_irqsave(&host->lock, flags);
> + if (host->sdio_irq_cnt == 0) {
> + enable_irq(host->eint_irq);
> + enable_irq_wake(host->eint_irq);
> + host->sdio_irq_cnt++;
> + }
> + sdr_clr_bits(host->base + SDC_CFG, SDC_CFG_SDIOIDE);
> + spin_unlock_irqrestore(&host->lock, flags);
> + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists