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

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

 



Hi Wolfram,

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);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[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