Re: net: dsa: bcm_sf2: Use devm_clk_get_optional_enabled() in bcm_sf2_sw_probe()
From: Markus Elfring
Date: Fri Nov 20 2026 - 02:00:49 EST
>> NACK, this patch is wrong because the remove function and the error handling path of the probe need to be updated.
>
> My bad you are right this creates the following regressions: devm_clk_get_optional_enabled() registers a devres action that calls clk_disable_unprepare() on detach. The patch leaves the manual
> clk_disable_unprepare(priv->clk) in two places in drivers/net/dsa/bcm_sf2.c: the probe error path (out_clk:) and bcm_sf2_sw_remove().
>
> pw-bot: cr
Do you expect more functionality from a devm_clk_get_optional_enabled() call
than from the combination of devm_clk_get_optional() and clk_prepare_enable() so far?
https://elixir.bootlin.com/linux/v7.4-rc1/source/include/linux/clk.h#L680-L699
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/driver-api/driver-model/devres.rst?id=d220c9443db6e5f20a60cad55c6a0ae7a75c63b8#n242
https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/net/dsa/bcm_sf2.c#L1365-L1568
Regards,
Markus