]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: get correct ops for clk_enable() and clk_disable()
authorYang Xiwen <forbidden405@outlook.com>
Sat, 18 Nov 2023 22:10:06 +0000 (06:10 +0800)
committerSean Anderson <seanga2@gmail.com>
Fri, 15 Dec 2023 17:31:47 +0000 (12:31 -0500)
assign clk_dev_ops(clkp->dev) to ops to ensure correct clk operations
are called on clocks.

This fixes the incorrect enable_count issue as described in [1].

[1]: https://lore.kernel.org/all/SEZPR06MB695927A6DEEEF8489A06897396A7A@SEZPR06MB6959.apcprd06.prod.outlook.com/

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20231111-enable_count-v2-2-20e3728600b5@outlook.com
drivers/clk/clk-uclass.c

index 3b5e3f9c86b327829a4d03e27f0752990a89331f..3e9d68feb3c779dac5aa8d0b04b15378067ae525 100644 (file)
@@ -640,6 +640,7 @@ int clk_enable(struct clk *clk)
        if (CONFIG_IS_ENABLED(CLK_CCF)) {
                /* Take id 0 as a non-valid clk, such as dummy */
                if (clk->id && !clk_get_by_id(clk->id, &clkp)) {
+                       ops = clk_dev_ops(clkp->dev);
                        if (clkp->enable_count) {
                                clkp->enable_count++;
                                return 0;
@@ -699,6 +700,7 @@ int clk_disable(struct clk *clk)
 
        if (CONFIG_IS_ENABLED(CLK_CCF)) {
                if (clk->id && !clk_get_by_id(clk->id, &clkp)) {
+                       ops = clk_dev_ops(clkp->dev);
                        if (clkp->flags & CLK_IS_CRITICAL)
                                return 0;