Re: [PATCH 1/6] firmware: arm_scmi: Simplify enable/disable Clock operations

From: Stephen Boyd
Date: Thu Aug 24 2023 - 14:44:30 EST


Quoting Cristian Marussi (2023-08-24 07:25:21)
> On Wed, Aug 23, 2023 at 11:01:17AM -0700, Stephen Boyd wrote:
> >
> > 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.
>

Surely the compiler can optimize that so there isn't stack local
storage for a local variable used as an argument to a function call?