Re: [PATCH v2 2/2] PCI: rcar-host: add support for optional regulators

From: Geert Uytterhoeven
Date: Thu May 11 2023 - 03:12:00 EST


Hi Wolfram,

On Wed, May 10, 2023 at 9:06 PM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> The KingFisher board has regulators. They just need to be en-/disabled,
> so we can leave the handling to devm. Order variables in reverse-xmas
> while we are here.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> ---
> Changes since v1:
>
> * use unsigned int for i
> * use reverse-xmas for variable declaration
> * really bail out now on error

Thanks for the update!

> --- a/drivers/pci/controller/pcie-rcar-host.c
> +++ b/drivers/pci/controller/pcie-rcar-host.c

> @@ -992,6 +999,15 @@ static int rcar_pcie_probe(struct platform_device *pdev)
> pcie->dev = dev;
> platform_set_drvdata(pdev, host);
>
> + for (i = 0; i < ARRAY_SIZE(rcar_pcie_supplies); i++) {
> + err = devm_regulator_get_enable_optional(dev, rcar_pcie_supplies[i]);
> + if (err < 0 && err != -ENODEV) {
> + dev_err_probe(dev, err, "error enabling regulator %s\n",
> + rcar_pcie_supplies[i]);
> + return err;

dev_err_probe() was designed for daisy-chaining, so please use

return dev_err_probe(...);

instead.

> + }
> + }
> +
> pm_runtime_enable(pcie->dev);
> err = pm_runtime_get_sync(pcie->dev);
> if (err < 0) {

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds