Re: [PATCH v2 14/15] drivers: thermal: tsens: Create function to return sign-extended temperature

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

 



Quoting Amit Kucheria (2019-08-28 03:35:28)
> (Resending, replied only to Stephen by mistake)
> 
> On Wed, Aug 28, 2019 at 6:08 AM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
> >
> > Quoting Amit Kucheria (2019-08-27 05:14:10)
> > > @@ -310,6 +328,10 @@ int __init init_common(struct tsens_priv *priv)
> > >                         goto err_put_device;
> > >                 }
> > >         }
> > > +
> > > +       /* Save away resolution of signed temperature value for this IP */
> > > +       priv->tempres = priv->fields[LAST_TEMP_0].msb - priv->fields
> [LAST_TEMP_0].lsb;
> > > +
> >
> > Why not just calculate this in the function that uses it? Is there a
> > reason to stash it away in the struct?
> 
> To avoid recalculating in an often-called function. It doesn't change for an IP
> version.
> 
> We can't make it static either inside that function since the initializer isn't
> constant.
> 

This sounds like a super micro optimization. It's a couple derefs and a
subtraction. If it isn't used anywhere else please just move it into the
function where it's used.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux