Thread (5 messages) 5 messages, 2 authors, 19d ago

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

flat view

From: Rosen Penev <hidden>
Date: 2026-09-21 22:06:51
Also in: linux-devicetree, linux-usb, lkml

On Mon, Sep 21, 2026 at 2:59 PM Rafał Miłecki [off-list ref] wrote:
W dniu 21.09.2026 o 23:41, Rosen Penev pisze:
quoted
@@ -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.
quoted
+     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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help