The FP9931 requires a mandatory "vin" power supply to operate.
Replace devm_regulator_get_optional() with devm_regulator_get() to
enforce this mandatory dependency.
Fixes: 12d821bd13d42 ("regulator: Add FP9931/JD9930 driver")
Signed-off-by: Robby Cai <robby.cai@nxp.com>
---
drivers/regulator/fp9931.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
index 69b3c712e5d58..d4ba818ec2c15 100644
--- a/drivers/regulator/fp9931.c
+++ b/drivers/regulator/fp9931.c
@@ -444,7 +444,7 @@ static int fp9931_probe(struct i2c_client *client)
return dev_err_probe(&client->dev, PTR_ERR(data->regmap),
"failed to allocate regmap!\n");
- data->vin_reg = devm_regulator_get_optional(&client->dev, "vin");
+ data->vin_reg = devm_regulator_get(&client->dev, "vin");
if (IS_ERR(data->vin_reg))
return dev_err_probe(&client->dev, PTR_ERR(data->vin_reg),
"failed to get vin regulator\n");
--
2.37.1
On Fri, Mar 13, 2026 at 09:31:02PM +0800, Robby Cai wrote:
> The FP9931 requires a mandatory "vin" power supply to operate.
> Replace devm_regulator_get_optional() with devm_regulator_get() to
> enforce this mandatory dependency.
>
> Fixes: 12d821bd13d42 ("regulator: Add FP9931/JD9930 driver")
> Signed-off-by: Robby Cai <robby.cai@nxp.com>
> ---
> drivers/regulator/fp9931.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
> index 69b3c712e5d58..d4ba818ec2c15 100644
> --- a/drivers/regulator/fp9931.c
> +++ b/drivers/regulator/fp9931.c
> @@ -444,7 +444,7 @@ static int fp9931_probe(struct i2c_client *client)
> return dev_err_probe(&client->dev, PTR_ERR(data->regmap),
> "failed to allocate regmap!\n");
>
> - data->vin_reg = devm_regulator_get_optional(&client->dev, "vin");
> + data->vin_reg = devm_regulator_get(&client->dev, "vin");
And this isn't an ABI break because the regulator core will invent a
dummy regulator?
What's the functional difference here?
> if (IS_ERR(data->vin_reg))
> return dev_err_probe(&client->dev, PTR_ERR(data->vin_reg),
> "failed to get vin regulator\n");
> --
> 2.37.1
>
On Fri, 13 Mar 2026 17:24:31 +0000
Conor Dooley <conor@kernel.org> wrote:
> On Fri, Mar 13, 2026 at 09:31:02PM +0800, Robby Cai wrote:
> > The FP9931 requires a mandatory "vin" power supply to operate.
> > Replace devm_regulator_get_optional() with devm_regulator_get() to
> > enforce this mandatory dependency.
> >
> > Fixes: 12d821bd13d42 ("regulator: Add FP9931/JD9930 driver")
> > Signed-off-by: Robby Cai <robby.cai@nxp.com>
> > ---
> > drivers/regulator/fp9931.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
> > index 69b3c712e5d58..d4ba818ec2c15 100644
> > --- a/drivers/regulator/fp9931.c
> > +++ b/drivers/regulator/fp9931.c
> > @@ -444,7 +444,7 @@ static int fp9931_probe(struct i2c_client *client)
> > return dev_err_probe(&client->dev, PTR_ERR(data->regmap),
> > "failed to allocate regmap!\n");
> >
> > - data->vin_reg = devm_regulator_get_optional(&client->dev, "vin");
> > + data->vin_reg = devm_regulator_get(&client->dev, "vin");
>
> And this isn't an ABI break because the regulator core will invent a
> dummy regulator?
>
On most devices I see a dummy regulator somewhere.
What IMHO itches more is that one has to invent a regulator in devicetree
if the property is mandatory and the supply is not known, you have to add
a dummy regulator in the devicetree to make dtbs_check happy.
Regards,
Andreas
On Fri, Mar 13, 2026 at 05:24:31PM +0000, Conor Dooley wrote:
> On Fri, Mar 13, 2026 at 09:31:02PM +0800, Robby Cai wrote:
> > The FP9931 requires a mandatory "vin" power supply to operate.
> > Replace devm_regulator_get_optional() with devm_regulator_get() to
> > enforce this mandatory dependency.
> >
> > Fixes: 12d821bd13d42 ("regulator: Add FP9931/JD9930 driver")
> > Signed-off-by: Robby Cai <robby.cai@nxp.com>
> > ---
> > drivers/regulator/fp9931.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
> > index 69b3c712e5d58..d4ba818ec2c15 100644
> > --- a/drivers/regulator/fp9931.c
> > +++ b/drivers/regulator/fp9931.c
> > @@ -444,7 +444,7 @@ static int fp9931_probe(struct i2c_client *client)
> > return dev_err_probe(&client->dev, PTR_ERR(data->regmap),
> > "failed to allocate regmap!\n");
> >
> > - data->vin_reg = devm_regulator_get_optional(&client->dev, "vin");
> > + data->vin_reg = devm_regulator_get(&client->dev, "vin");
>
> And this isn't an ABI break because the regulator core will invent a
> dummy regulator?
>
> What's the functional difference here?
>
Yes, this change does not introduce an ABI break.
If the DT already specifies the 'vin' supply, nothing changes.
If the DT omits 'vin', the previous driver treated that as "no regulator"
via devm_regulator_get_optional() [1]. After this change, the driver still
continues to probe; the regulator core reports that a dummy supply is
being used.
[1] The original handling of devm_regulator_get_optional() had a defect,
which v1 attempted to fix. Switching to devm_regulator_get() reflects
the actual hardware requirement.
Regards,
Robby
© 2016 - 2026 Red Hat, Inc.