Re: [PATCH v3 1/2] iio: light: driver for Vishay VEML6040

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

 



On Mon, 3 Jun 2024 12:18:58 +0000
Arthur Becker <arthur.becker@xxxxxxxxxx> wrote:

> From: Jonathan Cameron <jic23@xxxxxxxxxx>
> Sent: 02 June 2024 15:22
> To: Arthur Becker via B4 Relay
> Cc: Arthur Becker; Lars-Peter Clausen; Rob Herring; Krzysztof Kozlowski; Conor Dooley; linux-kernel@xxxxxxxxxxxxxxx; linux-iio@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx
> Subject: [EXTERNAL]Re: [PATCH v3 1/2] iio: light: driver for Vishay VEML6040
> 
> > Hi Arthur,
> > 
> > A few really trivial things inline. I'd have just tidied them up whilst
> > applying, but I think you are doing a v4 anyway to merge the bindings
> > so I'll leave the requested tweaks to you.
> > 
> > Jonathan  
> 
> Hi Jonathan,
> 
> Thanks for the feedback!
> Small question about that comment:
> 
> > > +
> > > +     ret = devm_regulator_get_enable(dev, "vdd");
> > > +     if (ret)
> > > +             return ret;
> > > +
> > > +     int init_config =  
> >
> > Generally we are still sticking to traditional C rules so keep the
> > local variable definition at the top of the file.
> > The only common exception is when cleanup.h functionality is involved and
> > we want to ensure ordering by moving the variable definitions into the code.  
> 
> Do you mean at the start of the function, or rather a #define at the top of the
> file after the masks and register definitions?
> The use of 'FIELD_PREP' discards the 'static const int' option to initialise the
> variable at the top of the file.

start of the function for the variable.
e.g.
int init_config;


stuff..

init_config = FIELD_PREP() where you have it

Thanks,

Jonathan

> 
> Kind regards,
> Arthur
> 
> >  
> > > +             FIELD_PREP(VEML6040_CONF_IT_MSK, VEML6040_CONF_IT_40_MS) |
> > > +             FIELD_PREP(VEML6040_CONF_AF_MSK, 0) |
> > > +             FIELD_PREP(VEML6040_CONF_SD_MSK, 0);
> > > +
> > > +     ret = regmap_write(regmap, VEML6040_CONF_REG, init_config);
> > > +     if (ret)
> > > +             return dev_err_probe(dev, ret,
> > > +                                  "Could not set initial config\n");
> > > +  
> 
> 





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux