Re: [RFC PATCH] i2c: refactor parsing of timings

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

 



On Thu, Mar 26, 2020 at 12:15:22PM +0100, Geert Uytterhoeven wrote:
> On Thu, Mar 26, 2020 at 11:52 AM Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
> > > > +{
> > > > +       int ret;
> > > > +
> > > > +       ret = device_property_read_u32(dev, prop_name, cur_val_p);
> > > > +       if (ret && use_def)
> > > > +               *cur_val_p = def_val;
> > >
> > > Alternatively, you could just preinitialize the value with the default value
> > > before calling this function, and ignoring ret.
> > > That would remove the need for both the def_val and use_def parameters.
> >
> > I can't do that because if !use_def and ret, then the value must not be
> > changed.
> 
> Of course the preinitialization must still be done conditionally:
> 
>     if (use_defaults)
>             t->foo = DEFAULT_FOO;
>     i2c_parse_timing(dev, "foo-name", &t->foo);

If the default *is* coming from timings structure?

Care to look at rcar case?

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux