Linux clock framework development
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: "Michael Turquette" <mturquette@baylibre.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-clk@vger.kernel.org, kernel@pengutronix.de,
	Sean Anderson <sean.anderson@seco.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Michal Simek <michal.simek@amd.com>,
	linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: Add a devm variant of clk_rate_exclusive_get()
Date: Sun, 17 Dec 2023 16:17:41 -0800	[thread overview]
Message-ID: <5391068cdc86b6117920d31a524d934b.sboyd@kernel.org> (raw)
In-Reply-To: <744a6371f94fe96f527eea6e52a600914e6fb6b5.1702403904.git.u.kleine-koenig@pengutronix.de>

Quoting Uwe Kleine-König (2023-12-12 10:09:42)
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index af2011c2a93b..78249ca2341c 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -937,6 +937,21 @@ void clk_rate_exclusive_get(struct clk *clk)
>  }
>  EXPORT_SYMBOL_GPL(clk_rate_exclusive_get);
>  
> +static void devm_clk_rate_exclusive_put(void *data)
> +{
> +       struct clk *clk = data;
> +
> +       clk_rate_exclusive_put(clk);
> +}
> +
> +int devm_clk_rate_exclusive_get(struct device *dev, struct clk *clk)
> +{
> +       clk_rate_exclusive_get(clk);

It seems the other thread wants this to return an error value.

> +
> +       return devm_add_action_or_reset(dev, devm_clk_rate_exclusive_put, clk);
> +}
> +EXPORT_SYMBOL_GPL(devm_clk_rate_exclusive_get);
> +
>  static void clk_core_unprepare(struct clk_core *core)
>  {
>         lockdep_assert_held(&prepare_lock);
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index f88c407925f8..5a749459c3a3 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -199,6 +199,18 @@ bool clk_is_match(const struct clk *p, const struct clk *q);
>   */
>  void clk_rate_exclusive_get(struct clk *clk);
>  
> +/**
> + * devm_clk_rate_exclusive_get - devm variant of clk_rate_exclusive_get
> + * @dev: device the exclusivity is bound to
> + * @clk: clock source
> + *
> + * Calls clk_rate_exclusive_get() on @clk and registers a devm cleanup handler
> + * on @dev to cal clk_rate_exclusive_put().

call

> + *
> + * Must not be called from within atomic context.
> + */
> +int devm_clk_rate_exclusive_get(struct device *dev, struct clk *clk);
> +
>  /**
>   * clk_rate_exclusive_put - release exclusivity over the rate control of a
>   *                          producer

  reply	other threads:[~2023-12-18  0:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 18:09 [PATCH 0/2] clk: Add a devm variant of clk_rate_exclusive_get() Uwe Kleine-König
2023-12-12 18:09 ` [PATCH 1/2] " Uwe Kleine-König
2023-12-18  0:17   ` Stephen Boyd [this message]
2023-12-18 13:01     ` Uwe Kleine-König
2024-01-04 18:06       ` Uwe Kleine-König
2024-01-04 21:38         ` Stephen Boyd
2024-01-04 23:01           ` Uwe Kleine-König
2023-12-12 18:09 ` [PATCH 2/2] pwm: xilinx: Simplify using devm functions Uwe Kleine-König

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=5391068cdc86b6117920d31a524d934b.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=michal.simek@amd.com \
    --cc=mturquette@baylibre.com \
    --cc=sean.anderson@seco.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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