Re: [PATCH v3 1/2] clk: Add generic sync_state callback for disabling unused clocks

From: Dmitry Baryshkov
Date: Thu Jan 05 2023 - 09:04:22 EST


On 27/12/2022 22:45, Abel Vesa wrote:
There are unused clocks that need to remain untouched by clk_disable_unused,
and most likely could be disabled later on sync_state. So provide a generic
sync_state callback for the clock providers that register such clocks.
Then, use the same mechanism as clk_disable_unused from that generic
callback, but pass the device to make sure only the clocks belonging to
the current clock provider get disabled, if unused. Also, during the
default clk_disable_unused, if the driver that registered the clock has
the generic clk_sync_state_disable_unused callback set for sync_state,
skip disabling its clocks.

Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxx>
---

Changes since v2:
* dropped the check for sync_state callback (clk_sync_state_disable_unused),
like Dmitry suggested

drivers/clk/clk.c | 57 +++++++++++++++++++++++++++++-------
include/linux/clk-provider.h | 1 +
2 files changed, 47 insertions(+), 11 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>

--
With best wishes
Dmitry