All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Mark Brown <broonie@kernel.org>
Cc: linux-clk@vger.kernel.org, kernel@pengutronix.de,
	linux-spi@vger.kernel.org
Subject: Re: [PATCH] spi: davinci: Simplify using devm_clk_get_prepared()
Date: Wed, 24 Mar 2021 21:22:58 +0100	[thread overview]
Message-ID: <20210324202258.bossedmrhj35nyvc@pengutronix.de> (raw)
In-Reply-To: <20210324201723.76299-1-u.kleine-koenig@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]

On Wed, Mar 24, 2021 at 09:17:23PM +0100, Uwe Kleine-König wrote:
> devm_clk_get_prepared returns the clk already prepared and the
> automatically called cleanup cares for unpreparing. So simplify .probe
> and .remove accordingly.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> this simplification depends on a patch set that introduces
> devm_clk_get_prepared() and friends.
> 
> The most recent version of this patch set can be found at
> 
> 	https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
> 
> Unfortunately I didn't get any feedback at all from the clk maintainers
> on it, so I try to make other maintainers aware of it in the expectation
> that the simplifications are welcome and so lure the clk maintainers to
> share their thoughts.
> 
> Best regards
> Uwe
> 
>  drivers/spi/spi-davinci.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
> index 7453a1dbbc06..c170bccf9710 100644
> --- a/drivers/spi/spi-davinci.c
> +++ b/drivers/spi/spi-davinci.c
> @@ -936,14 +936,11 @@ static int davinci_spi_probe(struct platform_device *pdev)
>  
>  	dspi->bitbang.master = master;
>  
> -	dspi->clk = devm_clk_get(&pdev->dev, NULL);
> +	dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);

oops, I got that wrong, this must be devm_clk_get_enabled, not
devm_clk_get_prepared. So if the clk patches go in, please let me resend
a fixed patch (or adapt yourself, whatever you prefer).

Best regards
Uwe

>  	if (IS_ERR(dspi->clk)) {
>  		ret = -ENODEV;
>  		goto free_master;
>  	}
> -	ret = clk_prepare_enable(dspi->clk);
> -	if (ret)
> -		goto free_master;

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-03-24 20:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 1/3] clk: generalize devm_clk_get() a bit Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 2/3] clk: Provide new devm_clk_helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 3/3] pwm: atmel: Simplify using devm_clk_get_prepared() Uwe Kleine-König
2021-03-22 14:22 ` [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-24 20:12 ` [PATCH] i2c: imx: Simplify using devm_clk_get_prepared() Uwe Kleine-König
2021-03-24 20:22   ` Uwe Kleine-König
2021-03-25  4:49     ` Oleksij Rempel
2021-03-26 13:42   ` kernel test robot
2021-03-26 13:42     ` kernel test robot
2021-03-31  3:37   ` kernel test robot
2021-03-31  3:37     ` kernel test robot
2021-03-24 20:17 ` [PATCH] spi: davinci: " Uwe Kleine-König
2021-03-24 20:22   ` Uwe Kleine-König [this message]
2021-03-30 17:04     ` Mark Brown
2021-03-30  4:09   ` kernel test robot
2021-03-30  4:09     ` kernel test robot
2021-03-24 20:27 ` [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled() Uwe Kleine-König
2021-03-24 20:27   ` Uwe Kleine-König
2021-03-25  1:11   ` kernel test robot
2021-03-25  1:11     ` kernel test robot
2021-03-25  1:11     ` kernel test robot
2021-03-25 15:15   ` kernel test robot
2021-03-25 15:15     ` kernel test robot
2021-03-25 15:15     ` kernel test robot

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=20210324202258.bossedmrhj35nyvc@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.