mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: neil.armstrong@linaro.org
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Thara Gopinath <thara.gopinath@gmail.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Stanimir Varbanov <svarbanov@mm-sol.com>
Cc: linux-crypto@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 4/9] crypto: qce - shrink code with devres clk helpers
Date: Tue, 3 Dec 2024 14:46:52 +0100	[thread overview]
Message-ID: <99f11abf-2417-40b1-a5c5-73c2f87e2eb3@linaro.org> (raw)
In-Reply-To: <20241203-crypto-qce-refactor-v1-4-c5901d2dd45c@linaro.org>

On 03/12/2024 10:19, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> Use devm_clk_get_optional_enabled() to avoid having to enable the clocks
> separately as well as putting the clocks in error path and the remove()
> callback.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>   drivers/crypto/qce/core.c | 29 ++++-------------------------
>   1 file changed, 4 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
> index f9ff1dfc1defe..cdcddf8f9f02b 100644
> --- a/drivers/crypto/qce/core.c
> +++ b/drivers/crypto/qce/core.c
> @@ -212,15 +212,15 @@ static int qce_crypto_probe(struct platform_device *pdev)
>   	if (ret < 0)
>   		return ret;
>   
> -	qce->core = devm_clk_get_optional(qce->dev, "core");
> +	qce->core = devm_clk_get_optional_enabled(qce->dev, "core");
>   	if (IS_ERR(qce->core))
>   		return PTR_ERR(qce->core);
>   
> -	qce->iface = devm_clk_get_optional(qce->dev, "iface");
> +	qce->iface = devm_clk_get_optional_enabled(qce->dev, "iface");
>   	if (IS_ERR(qce->iface))
>   		return PTR_ERR(qce->iface);
>   
> -	qce->bus = devm_clk_get_optional(qce->dev, "bus");
> +	qce->bus = devm_clk_get_optional_enabled(qce->dev, "bus");
>   	if (IS_ERR(qce->bus))
>   		return PTR_ERR(qce->bus);
>   
> @@ -232,21 +232,9 @@ static int qce_crypto_probe(struct platform_device *pdev)
>   	if (ret)
>   		return ret;
>   
> -	ret = clk_prepare_enable(qce->core);
> -	if (ret)
> -		return ret;
> -
> -	ret = clk_prepare_enable(qce->iface);
> -	if (ret)
> -		goto err_clks_core;
> -
> -	ret = clk_prepare_enable(qce->bus);
> -	if (ret)
> -		goto err_clks_iface;
> -
>   	ret = qce_dma_request(qce->dev, &qce->dma);
>   	if (ret)
> -		goto err_clks;
> +		return ret;
>   
>   	ret = qce_check_version(qce);
>   	if (ret)
> @@ -268,12 +256,6 @@ static int qce_crypto_probe(struct platform_device *pdev)
>   
>   err_dma:
>   	qce_dma_release(&qce->dma);
> -err_clks:
> -	clk_disable_unprepare(qce->bus);
> -err_clks_iface:
> -	clk_disable_unprepare(qce->iface);
> -err_clks_core:
> -	clk_disable_unprepare(qce->core);
>   
>   	return ret;
>   }
> @@ -285,9 +267,6 @@ static void qce_crypto_remove(struct platform_device *pdev)
>   	tasklet_kill(&qce->done_tasklet);
>   	qce_unregister_algs(qce);
>   	qce_dma_release(&qce->dma);
> -	clk_disable_unprepare(qce->bus);
> -	clk_disable_unprepare(qce->iface);
> -	clk_disable_unprepare(qce->core);
>   }
>   
>   static const struct of_device_id qce_crypto_of_match[] = {
> 

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

  reply	other threads:[~2024-12-03 13:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03  9:19 [PATCH 0/9] crypto: qce - refactor the driver Bartosz Golaszewski
2024-12-03  9:19 ` [PATCH 1/9] crypto: qce - fix goto jump in error path Bartosz Golaszewski
2024-12-03 13:43   ` neil.armstrong
2024-12-03  9:19 ` [PATCH 2/9] crypto: qce - unregister previously registered algos " Bartosz Golaszewski
2024-12-03 13:55   ` neil.armstrong
2024-12-03 15:05     ` Bartosz Golaszewski
2024-12-04 10:17       ` neil.armstrong
2024-12-03  9:19 ` [PATCH 3/9] crypto: qce - remove unneeded call to icc_set_bw() " Bartosz Golaszewski
2024-12-03 13:45   ` neil.armstrong
2024-12-03  9:19 ` [PATCH 4/9] crypto: qce - shrink code with devres clk helpers Bartosz Golaszewski
2024-12-03 13:46   ` neil.armstrong [this message]
2024-12-03 18:32   ` Stephan Gerhold
2024-12-03 20:39     ` Bartosz Golaszewski
2024-12-03  9:19 ` [PATCH 5/9] crypto: qce - convert qce_dma_request() to use devres Bartosz Golaszewski
2024-12-03 13:49   ` neil.armstrong
2024-12-03  9:19 ` [PATCH 6/9] crypto: qce - make qce_register_algs() a managed interface Bartosz Golaszewski
2024-12-03 13:50   ` neil.armstrong
2024-12-03  9:19 ` [PATCH 7/9] crypto: qce - use __free() for a buffer that's always freed Bartosz Golaszewski
2024-12-03 13:52   ` neil.armstrong
2024-12-03  9:19 ` [PATCH 8/9] crypto: qce - convert tasklet to workqueue Bartosz Golaszewski
2024-12-03 13:52   ` neil.armstrong
2024-12-03  9:19 ` [PATCH 9/9] crypto: qce - switch to using a mutex Bartosz Golaszewski
2024-12-03 13:53   ` neil.armstrong
2024-12-03 15:10     ` Bartosz Golaszewski
2024-12-04 10:17       ` neil.armstrong
2025-01-18  8:06       ` Eric Biggers
2025-01-18  9:28         ` Bartosz Golaszewski
2025-01-18 17:55           ` Eric Biggers
2025-01-20 13:46             ` Bartosz Golaszewski
2025-02-20  9:14               ` Bartosz Golaszewski
2025-02-20 19:19                 ` Eric Biggers
2024-12-03 17:35 ` [PATCH 0/9] crypto: qce - refactor the driver Eric Biggers
2024-12-03 18:08   ` Eric Biggers
2024-12-03 20:55   ` Bartosz Golaszewski
2024-12-14  9:27 ` Herbert Xu

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=99f11abf-2417-40b1-a5c5-73c2f87e2eb3@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=svarbanov@mm-sol.com \
    --cc=thara.gopinath@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®