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

Arthur Becker
2024-06-03T12:19:05Z

From: Jonathan Cameron <jic23@kernel.org>
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@vger.kernel.org; linux-iio@vger.kernel.org; devicetree@vger.kernel.org
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.

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