lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 24 Mar 2022 18:21:58 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Andy Gross <agross@...nel.org>,
        Ansuel Smith <ansuelsmth@...il.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Michael Turquette <mturquette@...libre.com>,
        Rob Herring <robh+dt@...nel.org>, devicetree@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 01/18] clk: introduce clk_hw_get_index_of_parent new API

Quoting Ansuel Smith (2022-03-21 16:15:31)
> Clk can have multiple parents. Some clk may require to get the cached
> index of other parent that are not current associated with the clk.
> We have clk_hw_get_parent_index() that returns the index of the current
> parent but we can't get the index of other parents of the provided clk.
> Introduce clk_hw_get_index_of_parent() to get the cached index of the
> parent of the provided clk. This permits a direct access of the internal
> clk_fetch_parent_index().
> 
> Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
> ---
>  drivers/clk/clk.c            | 14 ++++++++++++++
>  include/linux/clk-provider.h |  1 +
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 8de6a22498e7..bdd70a88394c 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1726,6 +1726,20 @@ int clk_hw_get_parent_index(struct clk_hw *hw)
>  }
>  EXPORT_SYMBOL_GPL(clk_hw_get_parent_index);
>  
> +/**
> + * clk_hw_get_index_of_parent - return the index of the parent clock

s/return/get/

> + * @hw: clk_hw associated with the clk being consumed
> + * @parent: clk_hw of the parent to be fetched the index of

s/to be fetched/to fetch/

> + *
> + * Fetches and returns the index of parent clock provided.
> + * Returns -EINVAL if the given parent index can't be provided.

I know this is copied from clk_hw_get_parent_index, but it can be
improved.

Return: The index corresponding to @parent for @hw or -EINVAL if
@parent isn't a possible parent of @hw.

> + */
> +int clk_hw_get_index_of_parent(struct clk_hw *hw, const struct clk_hw *parent)
> +{
> +       return clk_fetch_parent_index(hw->core, parent->core);
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_get_index_of_parent);
> +
>  /*
>   * Update the orphan status of @core and all its children.
>   */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ