[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240603192218.23ad1b99@jic23-huawei>
Date: Mon, 3 Jun 2024 19:22:18 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Arthur Becker <arthur.becker@...tec.com>
Cc: Arthur Becker via B4 Relay
<devnull+arthur.becker.sentec.com@...nel.org>, Lars-Peter Clausen
<lars@...afoo.de>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH v3 1/2] iio: light: driver for Vishay VEML6040
On Mon, 3 Jun 2024 12:18:58 +0000
Arthur Becker <arthur.becker@...tec.com> wrote:
> From: Jonathan Cameron <jic23@...nel.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@...r.kernel.org; linux-iio@...r.kernel.org; devicetree@...r.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.
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");
> > > +
>
>
Powered by blists - more mailing lists