public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Russell King <linux@armlinux.org.uk>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-bluetooth@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH RFC 1/2] clk: provide devm_clk_get_optional_enabled_with_rate()
Date: Fri, 02 Aug 2024 18:04:22 -0700	[thread overview]
Message-ID: <4b41be0c9874c5873c0cf4b6e210812d.sboyd@kernel.org> (raw)
In-Reply-To: <20240801-clk-new-helper-v1-1-81e9338b7b17@linaro.org>

Quoting Bartosz Golaszewski (2024-08-01 08:58:49)
> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
> index 90e6078fb6e1..34e800525e21 100644
> --- a/drivers/clk/clk-devres.c
> +++ b/drivers/clk/clk-devres.c
> @@ -99,6 +99,34 @@ struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id)
>  }
>  EXPORT_SYMBOL_GPL(devm_clk_get_optional_enabled);
>  
> +struct clk *devm_clk_get_optional_enabled_with_rate(struct device *dev,
> +                                                   const char *id,
> +                                                   unsigned long rate)
> +{
> +       struct clk *clk;
> +       int ret;
> +
> +       clk = __devm_clk_get(dev, id, clk_get_optional, NULL,
> +                            clk_disable_unprepare);
> +       if (IS_ERR(clk))
> +               return ERR_CAST(clk);
> +
> +       ret = clk_set_rate(clk, rate);
> +       if (ret)
> +               goto out_put_clk;
> +
> +       ret = clk_prepare_enable(clk);
> +       if (ret)
> +               goto out_put_clk;
> +
> +       return clk;
> +
> +out_put_clk:
> +       devm_clk_put(dev, clk);
> +       return ERR_PTR(ret);
> +}
> +EXPORT_SYMBOL(devm_clk_get_optional_enabled_with_rate);

GPL

  parent reply	other threads:[~2024-08-03  1:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 15:58 [PATCH RFC 0/2] clk: implement a new managed helper and add first user Bartosz Golaszewski
2024-08-01 15:58 ` [PATCH RFC 1/2] clk: provide devm_clk_get_optional_enabled_with_rate() Bartosz Golaszewski
2024-08-01 16:37   ` clk: implement a new managed helper and add first user bluez.test.bot
2024-08-03  1:04   ` Stephen Boyd [this message]
2024-08-01 15:58 ` [PATCH RFC 2/2] Bluetooth: hci_qca: use devm_clk_get_optional_enabled_with_rate() Bartosz Golaszewski

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=4b41be0c9874c5873c0cf4b6e210812d.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=mturquette@baylibre.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