From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Huan Yang <link@vivo.com>, Jassi Brar <jassisinghbrar@gmail.com>,
Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Subject: Re: [PATCH] mailbox: sprd: Use devm_clk_get_enabled() helpers
Date: Tue, 20 Aug 2024 15:19:47 +0200 [thread overview]
Message-ID: <ffe31e2b-1e21-4624-aa9d-558bbf4a880a@wanadoo.fr> (raw)
In-Reply-To: <20240820102255.132605-1-link@vivo.com>
Le 20/08/2024 à 12:22, Huan Yang a écrit :
> The devm_clk_get_enabled() helpers:
> - call devm_clk_get()
> - call clk_prepare_enable() and register what is needed in order to
> call clk_disable_unprepare() when needed, as a managed resource.
>
> This simplifies the code and avoids the calls to clk_disable_unprepare().
>
> Signed-off-by: Huan Yang <link@vivo.com>
> ---
Hi,
if you want to go 1 step further, I think that 'clk' can now also be
removed from struct sprd_mbox_priv.
Just my 2c.
CJ
> drivers/mailbox/sprd-mailbox.c | 19 +------------------
> 1 file changed, 1 insertion(+), 18 deletions(-)
>
> diff --git a/drivers/mailbox/sprd-mailbox.c b/drivers/mailbox/sprd-mailbox.c
> index 9ae57de77d4d..dca83026928f 100644
> --- a/drivers/mailbox/sprd-mailbox.c
> +++ b/drivers/mailbox/sprd-mailbox.c
> @@ -291,13 +291,6 @@ static const struct mbox_chan_ops sprd_mbox_ops = {
> .shutdown = sprd_mbox_shutdown,
> };
>
> -static void sprd_mbox_disable(void *data)
> -{
> - struct sprd_mbox_priv *priv = data;
> -
> - clk_disable_unprepare(priv->clk);
> -}
> -
> static int sprd_mbox_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -331,22 +324,12 @@ static int sprd_mbox_probe(struct platform_device *pdev)
> if (IS_ERR(priv->outbox_base))
> return PTR_ERR(priv->outbox_base);
>
> - priv->clk = devm_clk_get(dev, "enable");
> + priv->clk = devm_clk_get_enabled(dev, "enable");
> if (IS_ERR(priv->clk)) {
> dev_err(dev, "failed to get mailbox clock\n");
> return PTR_ERR(priv->clk);
> }
>
> - ret = clk_prepare_enable(priv->clk);
> - if (ret)
> - return ret;
> -
> - ret = devm_add_action_or_reset(dev, sprd_mbox_disable, priv);
> - if (ret) {
> - dev_err(dev, "failed to add mailbox disable action\n");
> - return ret;
> - }
> -
> inbox_irq = platform_get_irq_byname(pdev, "inbox");
> if (inbox_irq < 0)
> return inbox_irq;
prev parent reply other threads:[~2024-08-20 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 10:22 Huan Yang
2024-08-20 13:19 ` Christophe JAILLET [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=ffe31e2b-1e21-4624-aa9d-558bbf4a880a@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=baolin.wang@linux.alibaba.com \
--cc=jassisinghbrar@gmail.com \
--cc=link@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=orsonzhai@gmail.com \
--cc=zhang.lyra@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
all inboxes | Powered by JetHome®