mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Huan Yang <link@vivo.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com
Subject: Re: [PATCH] thermal: sprd: Use devm_clk_get_enabled() helpers
Date: Tue, 27 Aug 2024 16:35:45 +0800	[thread overview]
Message-ID: <d335fd2a-9ab6-4f91-aa11-559deb419433@linux.alibaba.com> (raw)
In-Reply-To: <20240820094450.101976-1-link@vivo.com>



On 2024/8/20 17:44, Huan Yang wrote:
> 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>

Thanks. LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/thermal/sprd_thermal.c | 14 +++-----------
>   1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
> index 874192546548..dfd1d529c410 100644
> --- a/drivers/thermal/sprd_thermal.c
> +++ b/drivers/thermal/sprd_thermal.c
> @@ -359,21 +359,17 @@ static int sprd_thm_probe(struct platform_device *pdev)
>   		return -EINVAL;
>   	}
>   
> -	thm->clk = devm_clk_get(&pdev->dev, "enable");
> +	thm->clk = devm_clk_get_enabled(&pdev->dev, "enable");
>   	if (IS_ERR(thm->clk)) {
>   		dev_err(&pdev->dev, "failed to get enable clock\n");
>   		return PTR_ERR(thm->clk);
>   	}
>   
> -	ret = clk_prepare_enable(thm->clk);
> -	if (ret)
> -		return ret;
> -
>   	sprd_thm_para_config(thm);
>   
>   	ret = sprd_thm_cal_read(np, "thm_sign_cal", &val);
>   	if (ret)
> -		goto disable_clk;
> +		return ret;
>   
>   	if (val > 0)
>   		thm->ratio_sign = -1;
> @@ -382,7 +378,7 @@ static int sprd_thm_probe(struct platform_device *pdev)
>   
>   	ret = sprd_thm_cal_read(np, "thm_ratio_cal", &thm->ratio_off);
>   	if (ret)
> -		goto disable_clk;
> +		return ret;
>   
>   	for_each_child_of_node(np, sen_child) {
>   		sen = devm_kzalloc(&pdev->dev, sizeof(*sen), GFP_KERNEL);
> @@ -439,8 +435,6 @@ static int sprd_thm_probe(struct platform_device *pdev)
>   
>   of_put:
>   	of_node_put(sen_child);
> -disable_clk:
> -	clk_disable_unprepare(thm->clk);
>   	return ret;
>   }
>   
> @@ -526,8 +520,6 @@ static void sprd_thm_remove(struct platform_device *pdev)
>   		devm_thermal_of_zone_unregister(&pdev->dev,
>   						thm->sensor[i]->tzd);
>   	}
> -
> -	clk_disable_unprepare(thm->clk);
>   }
>   
>   static const struct of_device_id sprd_thermal_of_match[] = {

  reply	other threads:[~2024-08-27  8:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  9:44 Huan Yang
2024-08-27  8:35 ` Baolin Wang [this message]
2024-09-02 11:14 ` Daniel Lezcano

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=d335fd2a-9ab6-4f91-aa11-559deb419433@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=link@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=opensource.kernel@vivo.com \
    --cc=orsonzhai@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.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®