Re: [PATCH 2/2] drivers: bus: simple-pm-bus: Get and deassert resets exclusively

From: Geert Uytterhoeven
Date: Fri Feb 23 2024 - 03:08:44 EST


Hi Yang,

On Fri, Feb 23, 2024 at 4:49 AM Yang Xiwen via B4 Relay
<devnull+forbidden405.outlook.com@xxxxxxxxxx> wrote:
> From: Yang Xiwen <forbidden405@xxxxxxxxxxx>
>
> Simple Power-Managed bus controller may need functional reset(s)
> to be deasserted before child devices connected to the bus can be
> accessed. Get the reset(s) as an array and assert/deassert the
> reset(s) when the bus is being power managed.
>
> One example is that HiSilicon USB2 INNO PHY test bus needs to deassert
> the reset to the bus before accessing its registers.
>
> Signed-off-by: Yang Xiwen <forbidden405@xxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/bus/simple-pm-bus.c
> +++ b/drivers/bus/simple-pm-bus.c
> @@ -62,6 +64,10 @@ static int simple_pm_bus_probe(struct platform_device *pdev)
> if (bus->num_clks < 0)
> return dev_err_probe(&pdev->dev, bus->num_clks, "failed to get clocks\n");
>
> + bus->rsts = devm_reset_control_array_get(dev, false, true);

Please use the devm_reset_control_array_get_optional_exclusive()
wrapper.

> + if (IS_ERR(bus->rsts))
> + return dev_err_probe(&pdev->dev, PTR_ERR(bus->rsts), "failed to get resets\n");
> +
> dev_set_drvdata(&pdev->dev, bus);
>
> dev_dbg(&pdev->dev, "%s\n", __func__);

The rest LGTM, so
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

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

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