[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAO4ZVTPAX8FsSWHNAbCV3XSEe5BjDM+s9cB_TbF-2t8g-u4TKQ@mail.gmail.com>
Date: Thu, 12 Sep 2019 08:32:19 +0200
From: Maxime Ripard <maxime.ripard@...ndra.org>
To: Corentin Labbe <clabbe.montjoie@...il.com>
Cc: davem@...emloft.net, herbert@...dor.apana.org.au,
Maxime Ripard <mripard@...nel.org>,
Chen-Yu Tsai <wens@...e.org>,
linux-arm-kernel@...ts.infradead.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-sunxi@...glegroups.com
Subject: Re: [PATCH 1/2] crypto: sun4i-ss: simplify enable/disable of the device
Hi,
Le mer. 11 sept. 2019 à 13:46, Corentin Labbe
<clabbe.montjoie@...il.com> a écrit :
>
> This patch regroups resource enabling/disabling in dedicated function.
> This simplify error handling and will permit to support power
> management.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@...il.com>
> ---
> drivers/crypto/sunxi-ss/sun4i-ss-core.c | 73 ++++++++++++++-----------
> 1 file changed, 42 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-core.c b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
> index 9aa6fe081a27..2c9ff01dddfc 100644
> --- a/drivers/crypto/sunxi-ss/sun4i-ss-core.c
> +++ b/drivers/crypto/sunxi-ss/sun4i-ss-core.c
> @@ -223,6 +223,41 @@ static struct sun4i_ss_alg_template ss_algs[] = {
> #endif
> };
>
> +static void sun4i_ss_disable(struct sun4i_ss_ctx *ss)
> +{
> + if (ss->reset)
> + reset_control_assert(ss->reset);
> + clk_disable_unprepare(ss->ssclk);
> + clk_disable_unprepare(ss->busclk);
> +}
While you're at it, can you add a new line after the reset_control_assert here?
> +static int sun4i_ss_enable(struct sun4i_ss_ctx *ss)
> +{
> + int err;
> +
> + err = clk_prepare_enable(ss->busclk);
> + if (err) {
> + dev_err(ss->dev, "Cannot prepare_enable busclk\n");
> + goto err_enable;
> + }
> + err = clk_prepare_enable(ss->ssclk);
> + if (err) {
> + dev_err(ss->dev, "Cannot prepare_enable ssclk\n");
> + goto err_enable;
> + }
> + if (ss->reset) {
> + err = reset_control_deassert(ss->reset);
> + if (err) {
> + dev_err(ss->dev, "Cannot deassert reset control\n");
> + goto err_enable;
> + }
> + }
> + return err;
And after each block here?
With that fixed:
Acked-by: Maxime Ripard <mripard@...nel.org>
Thanks!
Maxime
Powered by blists - more mailing lists