clk: at91: fix possible dead lock in new drivers
authorAhmad Fatoum <a.fatoum@pengutronix.de>
Fri, 3 Jul 2020 07:32:35 +0000 (09:32 +0200)
committerStephen Boyd <sboyd@kernel.org>
Fri, 24 Jul 2020 09:18:42 +0000 (02:18 -0700)
syscon_node_to_regmap() will make the created regmap get and enable the
first clock it can parse from the device tree. This clock is not needed to
access the registers and should not be enabled at that time.

Use device_node_to_regmap to resolve this as it looks up the regmap in
the same list but doesn't care about the clocks. This issue is detected
by lockdep when booting the sama5d3 with a device tree containing the
new clk bindings.

This fix already happened in 6956eb33abb5 ("clk: at91: fix possible
deadlock") for the drivers that had been migrated to the new clk binding
back then. This does the same for the new drivers as well.

Fixes: 01e2113de9a5 ("clk: at91: add sam9x60 pmc driver")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.kernel.org/r/20200703073236.23923-1-a.fatoum@pengutronix.de
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/at91/at91sam9g45.c
drivers/clk/at91/at91sam9n12.c
drivers/clk/at91/sam9x60.c
drivers/clk/at91/sama5d3.c

index 9873b583c26045e1b807c7fde906da3f9fa0e1fb..fe9d391adebaedf170de4ee820f157548fd5fa1a 100644 (file)
@@ -111,7 +111,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
                return;
        mainxtal_name = of_clk_get_parent_name(np, i);
 
-       regmap = syscon_node_to_regmap(np);
+       regmap = device_node_to_regmap(np);
        if (IS_ERR(regmap))
                return;
 
index 630dc5d87171ad74d7d95e841e915fe56d24f28f..4aa97e672bd6f0a27926fe10561809b7f8832b26 100644 (file)
@@ -124,7 +124,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
                return;
        mainxtal_name = of_clk_get_parent_name(np, i);
 
-       regmap = syscon_node_to_regmap(np);
+       regmap = device_node_to_regmap(np);
        if (IS_ERR(regmap))
                return;
 
index 3e20aa68259fd2aa9a7fb958baadf6b11b101c03..2b4c67485eee84966d77c0df84b63ce652531ee9 100644 (file)
@@ -178,7 +178,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
                return;
        mainxtal_name = of_clk_get_parent_name(np, i);
 
-       regmap = syscon_node_to_regmap(np);
+       regmap = device_node_to_regmap(np);
        if (IS_ERR(regmap))
                return;
 
index 5e4e44dd4c37c39b22f5aeb28882e405563055f0..5609b04e656582cff69147572c8bf385fd6c1fa0 100644 (file)
@@ -121,7 +121,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
                return;
        mainxtal_name = of_clk_get_parent_name(np, i);
 
-       regmap = syscon_node_to_regmap(np);
+       regmap = device_node_to_regmap(np);
        if (IS_ERR(regmap))
                return;