Re: [PATCH v3 5/5] regulator: ltm8054: Support output current limit control

From: Romain Gantois

Date: Fri Nov 07 2025 - 09:54:47 EST


Hello Andy,

On Thursday, 6 November 2025 19:32:29 CET Andy Shevchenko wrote:
> On Thu, Nov 06, 2025 at 03:11:50PM +0100, Romain Gantois wrote:
> > The LTM8054 supports setting a fixed output current limit using a sense
> > resistor connected to a dedicated pin. This limit can then be lowered
> > dynamically by varying the voltage level of the CTL pin.
...
> > + ctl_dac = devm_iio_channel_get(&pdev->dev, "ctl");
> > + if (IS_ERR(ctl_dac)) {
> >
> > + if (PTR_ERR(ctl_dac) == -ENODEV)
> > + return ERR_PTR(-EPROBE_DEFER);
>
> Hmm... Are you sure about this?

The only case where I want to defer is if the IO channel hasn't been created
yet. From what I've read in iio_channel_get(), -ENODEV is returned specifically
in this case. For example in fwnode_iio_channel_get_by_name() you have:

```
if (!IS_ERR(chan) || PTR_ERR(chan) != -ENODEV)
return chan;
```

> >
> > priv->rdesc.type = REGULATOR_VOLTAGE;
> > priv->rdesc.owner = THIS_MODULE;
> >
> > + if (ctl_dac) {
> > + priv->ctl_dac = ctl_dac;
> >
> > + INIT_WORK(&priv->ctl_work.work, ltm8054_do_ctl_work);
> > + init_completion(&priv->ctl_rw_done);
>
> Do devm-helpers.h APIs help with something here? Does
> devm_add_action_or_reset() help with not covered cases?

I could definitely use a cleanup action to flush the ctl pin work item instead
of doing it in a remove() function. It would also remove the gotos below.

Thanks,

--
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Attachment: signature.asc
Description: This is a digitally signed message part.