On 26/06/02 10:02PM, Andy Shevchenko wrote:
> On Tue, Jun 02, 2026 at 05:33:52PM +0100, Rodrigo Alencar via B4 Relay wrote:
> > 
> > Get and enable regulators for vdd, vlogic and vref input power pins. Vdd
> > is the input power supply, while vlogic powers the digital side. vref is
> > replacing vcc, which is being deprecated, but still supported. The value
> > of vref_mv is checked so that a device without internal voltage reference
> > cannot proceed without an explicit supply. For correct operation, vdd and
> > vlogic are required, then devm_regulator_get_enable() is used so the
> > driver can still work without them by using the stub/dummy regulators.
> > Error report uses dev_err_probe(), which helps debugging an init issue.
> 
> ...
> 
> > +   ret = devm_regulator_get_enable_read_voltage(dev, "vref");
> > +   if (ret == -ENODEV) /* vcc-supply is deprecated, but supported still */
> > +           ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
> 
> >     if (ret < 0 && ret != -ENODEV)
> 
> It can be deduplicated now with
> 
>       else if (ret < 0)

Not really, because ret is overwritten with

        ret = devm_regulator_get_enable_read_voltage(dev, "vcc")

so the check for if (ret < 0 && ret != -ENODEV) is intentional
 
> > -           return ret;
> > +           return dev_err_probe(dev, ret, "failed to read vref voltage\n");

-- 
Kind regards,

Rodrigo Alencar

Reply via email to