Re: [PATCH v2 3/4] iio: light: stk3310: add vdd regulator support
From: Roman Vivchar
Date: Thu Nov 19 2026 - 11:33:35 EST
Hi Jonathan, Joshua,
On Thursday, November 19th, 2026 at 5:32 AM, Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> On Wed, 18 Nov 2026 11:01:38 +0100
> Joshua Crofts <crofts@xxxxxxxxxx> wrote:
>
> > On Tue, 17 Nov 2026 20:08:37 +0200
> > Roman Vivchar via B4 Relay <devnull+rva333.protonmail.com@xxxxxxxxxx> wrote:
> >
> > > @@ -745,6 +746,10 @@ static int stk3310_probe(struct i2c_client *client)
> > > device_property_read_u32(&client->dev, "proximity-near-level",
> > > &data->ps_near_level);
> > >
> > > + ret = devm_regulator_get_enable(dev, "vdd");
> > > + if (ret)
> > > + return dev_err_probe(dev, ret, "failed to get vdd supply\n");
> > > +
> >
> > IMO this should work, but I don't like the mixing of devm_* and non-devm_*
> > functions, this may cause issues down the road. Consider moving the driver
> > to all devm_* functions?
>
> In this particular case I agree with you because the conversion is very
> simple. Generally the rule of thumb is that devm from start of probe
> until you decide to stop, then no more devm. In that case the unwind
> order should be correct. This change doesn't break that, but the
> driver already breaks this wrt to the interrupt, so if Roman
> doesn't mind would be great to fix it whilst touching the driver.
>
Sure, I will include one more patch for devm_* API migration before
adding regulator and new chip support.
I recently found another STK3337 variant on yet another development device,
called STK3331. It seems to be exactly the same, except for the chip ID.
Should I include it in the next revision, or send it as a separate series
later?
Best regards,
Roman