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]
Message-ID: <ZOdoP00tlAIRr9fN@pluto>
Date:   Thu, 24 Aug 2023 15:25:21 +0100
From:   Cristian Marussi <cristian.marussi@....com>
To:     Stephen Boyd <sboyd@...nel.org>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        sudeep.holla@....com, james.quinlan@...adcom.com,
        f.fainelli@...il.com, vincent.guittot@...aro.org,
        etienne.carriere@...aro.org, peng.fan@....nxp.com,
        chuck.cannon@....com, souvik.chakravarty@....com,
        nicola.mazzucato@....com,
        Michael Turquette <mturquette@...libre.com>,
        linux-clk@...r.kernel.org
Subject: Re: [PATCH 1/6] firmware: arm_scmi: Simplify enable/disable Clock
 operations

On Wed, Aug 23, 2023 at 11:01:17AM -0700, Stephen Boyd wrote:
> Quoting Cristian Marussi (2023-08-23 02:02:46)
> > On Tue, Aug 22, 2023 at 01:17:15PM -0700, Stephen Boyd wrote:
> > > Quoting Cristian Marussi (2023-08-11 09:14:41)
> > > > Add a param to Clock enable/disable operation to ask for atomic operation
> > > > and remove _atomic version of such operations.
> > > 
> > 
> > Hi,
> 
> Yo
> 
> > 
> > > Why?
> > > 
> > 
> > :D, given that the 2 flavours of SCMI enable/disable ops (and the upcoming
> > state_get) just differ in their operating mode (atomic or not) and the
> > Clock framework in turn wrap such calls into 4 related and explicitly
> > named clk_ops (scmi_clock_enable/scmi_clock_atomic_enable etc) that hint
> > at what is being done, seemed to me reasonable to reduce the churn and
> > remove a bit of code wrappers in favour of a param.
> 
> Please add these extra details to the commit text about why we're making
> the change.
> 
Sure I'll do.

> > 
> > > > 
> > > > No functional change.
> > > > 
> > > > CC: Michael Turquette <mturquette@...libre.com>
> > > > CC: Stephen Boyd <sboyd@...nel.org>
> > > > CC: linux-clk@...r.kernel.org
> > > > Signed-off-by: Cristian Marussi <cristian.marussi@....com>
> > > > ---
> > > >  drivers/clk/clk-scmi.c            |  8 ++++----
> > > >  drivers/firmware/arm_scmi/clock.c | 24 ++++++------------------
> > > >  include/linux/scmi_protocol.h     |  9 ++++-----
> > > >  3 files changed, 14 insertions(+), 27 deletions(-)
> > > > 
> > > > diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
> > > > index 2c7a830ce308..ff003083e592 100644
> > > > --- a/drivers/clk/clk-scmi.c
> > > > +++ b/drivers/clk/clk-scmi.c
> > > > @@ -78,28 +78,28 @@ static int scmi_clk_enable(struct clk_hw *hw)
> > > >  {
> > > >         struct scmi_clk *clk = to_scmi_clk(hw);
> > > >  
> > > > -       return scmi_proto_clk_ops->enable(clk->ph, clk->id);
> > > > +       return scmi_proto_clk_ops->enable(clk->ph, clk->id, false);
> > > >  }
> > > >  
> > > >  static void scmi_clk_disable(struct clk_hw *hw)
> > > >  {
> > > >         struct scmi_clk *clk = to_scmi_clk(hw);
> > > >  
> > > > -       scmi_proto_clk_ops->disable(clk->ph, clk->id);
> > > > +       scmi_proto_clk_ops->disable(clk->ph, clk->id, false);
> > > 
> > > I enjoyed how it was before because I don't know what 'false' means
> > > without looking at the ops now.
> > > 
> > 
> > Yes indeed, I can drop this and rework if you prefer to maintain the old
> > API calls, but this would mean that whenever we'll add new atomic
> > flavour to some new SCMI clk operations we'll have to add 2 ops instead
> > of a parametrized one...this is what would happen also in this series
> > with state_get (and what really triggered this refactor)
> > 
> > (and please consider that on the SCMI side, for testing purposes, I would
> > prefer to expose always both atomic and non-atomic flavours even if NOT
> > both actively used by the Clock framework...like state_get() that can only
> > be atomic for Clock frmwk...)
> > 
> 
> Perhaps we need a local variable to make it more readable.
> 
> 	static int scmi_clk_enable(struct clk_hw *hw)
> 	{
> 	       bool can_sleep = false;
> 	       struct scmi_clk *clk = to_scmi_clk(hw);
> 
> 	       return scmi_proto_clk_ops->enable(clk->ph, clk->id, can_sleep);
> 	}
> 
> This let's the reader quickly understand what the parameter means. I'm
> OK with adding the function parameter, but a plain 'true' or 'false'
> doesn't help with clarity.

Thanks for the suggestion, it would help definitely making it more
readable, maybe a local define or enum could make it without even
putting anything on the stack.

Thanks,
Cristian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ