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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YjDV3n1Xq/EGWU1E@Ansuel-xps.localdomain>
Date:   Tue, 15 Mar 2022 19:07:26 +0100
From:   Ansuel Smith <ansuelsmth@...il.com>
To:     Stephen Boyd <sboyd@...nel.org>
Cc:     Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Michael Turquette <mturquette@...libre.com>,
        Peter De Schrijver <pdeschrijver@...dia.com>,
        Prashant Gaikwad <pgaikwad@...dia.com>,
        Rob Herring <robh+dt@...nel.org>,
        Thierry Reding <thierry.reding@...il.com>,
        devicetree@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-tegra@...r.kernel.org
Subject: Re: [PATCH 01/16] clk: permit to define a custom parent for
 clk_hw_get_parent_index

On Tue, Mar 15, 2022 at 10:55:18AM -0700, Stephen Boyd wrote:
> Quoting Ansuel Smith (2022-03-13 12:04:04)
> > 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.
> > Extend clk_hw_get_parent_index() with an optional parent to permit a
> > driver to get the cached index. If parent is NULL, the parent associated
> > with the provided hw clk is used.
> > 
> > Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
> > ---
> >  drivers/clk/clk.c                 | 14 +++++++++-----
> >  drivers/clk/tegra/clk-periph.c    |  2 +-
> >  drivers/clk/tegra/clk-sdmmc-mux.c |  2 +-
> >  drivers/clk/tegra/clk-super.c     |  4 ++--
> >  include/linux/clk-provider.h      |  2 +-
> >  5 files changed, 14 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 8de6a22498e7..fe42f56bfbdf 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -1711,15 +1711,19 @@ static int clk_fetch_parent_index(struct clk_core *core,
> >  /**
> >   * clk_hw_get_parent_index - return the index of the parent clock
> >   * @hw: clk_hw associated with the clk being consumed
> > + * @parent: optional clk_hw of the parent to be fetched
> >   *
> > - * Fetches and returns the index of parent clock. Returns -EINVAL if the given
> > - * clock does not have a current parent.
> > + * Fetches and returns the index of parent clock. If parent is not
> > + * provided the parent of hw is used.
> > + * Returns -EINVAL if the given clock does not have a current parent.
> >   */
> > -int clk_hw_get_parent_index(struct clk_hw *hw)
> > +int clk_hw_get_parent_index(struct clk_hw *hw, struct clk_hw *parent)
> 
> Please introduce another API vs. tacking on an "output" argument to this
> API. That makes the patch less invasive. And it can also return a
> pointer instead of an integer in that case.
>

Any suggestion about the name? clk_hw_fetch_parent_index? That would be
a direct access of the internal clk_fetch_parent_index.

The name is already not that intuitive as is. The alternative is to make
it extra long, don't know if that's a problem...
Something like clk_hw_get_parent_index_by_parent? (that is even more
confusing)

> >  {
> > -       struct clk_hw *parent = clk_hw_get_parent(hw);
> > +       /* With parent NULL get the current parent of hw */
> > +       if (!parent)
> > +               parent = clk_hw_get_parent(hw);

-- 
	Ansuel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ