Re: [PATCH v2 09/10] iio: light: opt3001: switch driver to managed resources
From: Joshua Crofts
Date: Tue May 12 2026 - 11:18:12 EST
On Tue, 12 May 2026 at 16:26, Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> On Tue, 12 May 2026 12:57:29 +0200
> Joshua Crofts via B4 Relay <devnull+joshua.crofts1.gmail.com@xxxxxxxxxx> wrote:
>
> > From: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
> >
> > Move the driver to use devm_* functions to automate resource
> > management and simplify error handling. This also allows removal
> > of the opt3001_remove() function.
> >
> > Signed-off-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
> Some trivial stuff inline. I'll probably wait for sashiko to catch up with
> it's backlog and get to this one. If nothing comes up there or in other reviews
> I'm fine tweaking the stuff below whilst applying the series.
>
> Jonathan
>
> > ---
> > drivers/iio/light/opt3001.c | 75 +++++++++++++++++++++++----------------------
> > 1 file changed, 39 insertions(+), 36 deletions(-)
> >
> > diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c
> > index 39ea60c0af2c1ec7473d49b73778cac1f9bb6086..1319e5941b66bd82e4dc2badf5ea27cacbcfd54a 100644
> > --- a/drivers/iio/light/opt3001.c
> > +++ b/drivers/iio/light/opt3001.c
> > @@ -702,6 +702,31 @@ static int opt3001_read_id(struct opt3001 *opt)
> > return 0;
> > }
> >
> > +static void opt3001_power_off(void *data)
> > +{
> > + struct opt3001 *opt = data;
> > + struct i2c_client *client = opt->client;
> > + struct device *dev = opt->dev;
> > +
> Really trivial but why the blank line here? If nothing else comes up
> I might bother dropping it whilst picking up the series.
Oh, that must've been an accident.
> > + int ret;
> > + u16 reg;
> Obviously not a change you made - but none the less reg is a bad name.
> It is often used for register address rather than value. So better as
> regval. Again maybe I'll tweak this if nothing comes up but if you
> do another version for other reasons nice to change it.
Fair enough, reg is a bit of a bad name for a variable. As per Sashiko
catching up - it has 10 pages of entries to go, so here's hoping it goes
fast.
--
Kind regards
CJD