Re: [PATCH RFC 1/2] clk: provide devm_clk_get_optional_enabled_with_rate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux