From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Axe Yang <axe.yang@mediatek.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: Mon, 27 Dec 2021 19:27:53 +0200 [thread overview]
Message-ID: <CAHp75VcVx4Yf69TEoSy8GL-he9ZAW+yvoH8-DXAotQ3Mwx7n2A@mail.gmail.com> (raw)
In-Reply-To: <20211227083641.12538-4-axe.yang@mediatek.com>
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.
> + 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
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2021-12-27 17:28 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 [this message]
2021-12-29 9:12 ` Axe Yang
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=CAHp75VcVx4Yf69TEoSy8GL-he9ZAW+yvoH8-DXAotQ3Mwx7n2A@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=andrew@aj.id.au \
--cc=andriy.shevchenko@linux.intel.com \
--cc=axe.yang@mediatek.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).