On Mon, Jul 21, 2025 at 10:20:42AM +0100, Suzuki Kuruppassery Poulose wrote:
On 27/06/2025 12:51, Leo Yan wrote:
Some CoreSight components have trace bus clocks 'atclk' and are enabled using clk_prepare_enable(). These clocks are not disabled when modules exit.
As atclk is optional, use devm_clk_get_optional_enabled() to manage it. The benefit is the driver model layer can automatically disable and release clocks.
Check the returned value with IS_ERR() to detect errors but leave the NULL pointer case if the clock is not found. And remove the error handling codes which are no longer needed.
Fixes: d1839e687773 ("coresight: etm: retrieve and handle atclk")
I would drop this tag as I don't see what we are fixing ?
This patch changes the clock operations from:
atclk = devm_clk_get(dev, "atclk"); clk_prepare_enable(atclk);
to:
atclk = devm_clk_get_optional_enabled(dev, "atclk");
The commit log mentions in the old approach, "clocks are not disabled when modules exit." So the patch is not only a refactoring, it changes to use devm_clk_get_optional_enabled() to register clk_disable_unprepare() as a callback to disable clock when the device is released.
BTW, I selected the commit "d1839e687773" as the Fixed tag as it is the first commit that introduced the devm_clk_get() + clk_prepare_enable().
If there is indeed something, I would recommend:
- Call it out in the commit description.
- Move that as a separate patch, so that it can be safely backported without touching all the other drivers.
If you agree with the above, I will drop the "Fixes" tag and can merge it.
Please let me know if anything I can follow up.
Thanks, Leo