From: Marek Vasut <marex@denx.de>
To: Mingwei Zheng <zmw12306@gmail.com>,
linus.walleij@linaro.org, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, make24@iscas.ac.cn,
peng.fan@nxp.com, fabien.dessenne@foss.st.com
Cc: linux-gpio@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Jiasheng Jiang <jiashengjiangcool@gmail.com>
Subject: Re: [PATCH] pinctrl: stm32: Add check for clk_enable()
Date: Thu, 5 Dec 2024 06:07:51 +0100 [thread overview]
Message-ID: <3c809cae-991b-4b13-8d8b-bd6cbcc9a9b9@denx.de> (raw)
In-Reply-To: <20241205045942.2441430-1-zmw12306@gmail.com>
On 12/5/24 5:59 AM, Mingwei Zheng wrote:
> Add check for the return value of clk_enable() to catch the potential
> error. Add a cleanup loop to disable clocks already enabled in case
> of an error during clock enabling for subsequent banks.
>
> Fixes: 05d8af449d93 ("pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested")
> Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> ---
> drivers/pinctrl/stm32/pinctrl-stm32.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index 5b7fa77c1184..eb7b2f864d88 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1738,10 +1738,16 @@ int __maybe_unused stm32_pinctrl_resume(struct device *dev)
> {
> struct stm32_pinctrl *pctl = dev_get_drvdata(dev);
> struct stm32_pinctrl_group *g = pctl->groups;
> - int i;
> + int i, j, ret;
>
> - for (i = 0; i < pctl->nbanks; i++)
> - clk_enable(pctl->banks[i].clk);
> + for (i = 0; i < pctl->nbanks; i++) {
> + ret = clk_enable(pctl->banks[i].clk);
> + if (ret) {
> + for (j = 0; j < i; j++)
Instead of this open-coded loop, can you please convert the driver to
clk_bulk*() API and then do simple clk_bulk_enable()/clk_bulk_disable()
here and everywhere ?
Thank you
prev parent reply other threads:[~2024-12-05 5:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 4:59 [PATCH] pinctrl: stm32: Add check for clk_enable() Mingwei Zheng
2024-12-05 5:07 ` Marek Vasut [this message]
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=3c809cae-991b-4b13-8d8b-bd6cbcc9a9b9@denx.de \
--to=marex@denx.de \
--cc=alexandre.torgue@foss.st.com \
--cc=fabien.dessenne@foss.st.com \
--cc=jiashengjiangcool@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=make24@iscas.ac.cn \
--cc=mcoquelin.stm32@gmail.com \
--cc=peng.fan@nxp.com \
--cc=zmw12306@gmail.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