[PATCHv2 1/2] usb: bcma: add regulator support

Rosen Penev rosenp at gmail.com
Mon Sep 21 15:06:28 PDT 2026


On Mon, Sep 21, 2026 at 2:59 PM Rafał Miłecki <zajec5 at gmail.com> wrote:
>
> W dniu 21.09.2026 o 23:41, Rosen Penev pisze:
> > @@ -411,6 +422,14 @@ static int bcma_hcd_probe(struct bcma_device *core)
> >               return dev_err_probe(&core->dev, PTR_ERR(usb_dev->gpio_desc),
> >                                    "error obtaining VCC GPIO");
> >
> > +     usb_dev->regulator = devm_regulator_get(dev, "vbus");
> > +     if (IS_ERR(usb_dev->regulator))
> > +             return dev_err_probe(dev, PTR_ERR(usb_dev->regulator), "error obtaining VBUS regulator");
>
> Did you test this for DT without VBUS? You seem to *require* regulator. Shouldn't you make it optional?
Nope. Confusingly, devm_regulator_get_optional returns -ENODEV if a
regulator is missing, which means probe will fail.

I could remove the return but then I would need to guard all
regulator_en/disable calls with IS_ERR. Much cleaner to have a dummy
regulator.
>
>
> > +     err = regulator_enable(usb_dev->regulator);
> > +     if (err)
> > +             return dev_err_probe(dev, err, "error enabling VCC regulator");
> > +
>
> Can't you use one of devm helpers that get and enable regulator for you?
nope. devm_regulator_get_enable_optional returns an int, not a
pointer. This driver requires management of the regulator in suspend
and resume paths.



More information about the linux-arm-kernel mailing list