Skip to content

Commit c28cd1f

Browse files
Saravana Kannanbebarino
authored andcommitted
clk: Mark a fwnode as initialized when using CLK_OF_DECLARE() macro
We already mark fwnodes as initialized when they are registered as clock providers. We do this so that fw_devlink can tell when a clock driver doesn't use the driver core framework to probe/initialize its device. This ensures fw_devlink doesn't block the consumers of such a clock provider indefinitely. However, some users of CLK_OF_DECLARE() macros don't use the same node that matches the macro as the node for the clock provider, but they initialize the entire node. To cover these cases, also mark the nodes that match the macros as initialized when the init callback function is called. An example of this is "stericsson,u8500-clks" that's handled using CLK_OF_DECLARE() and looks something like this: clocks { compatible = "stericsson,u8500-clks"; prcmu_clk: prcmu-clock { #clock-cells = <1>; }; prcc_pclk: prcc-periph-clock { #clock-cells = <2>; }; prcc_kclk: prcc-kernel-clock { #clock-cells = <2>; }; prcc_reset: prcc-reset-controller { #reset-cells = <2>; }; ... }; This patch makes sure that "clocks" is marked as initialized so that fw_devlink knows that all nodes under it have been initialized. If the driver creates struct devices for some of the subnodes, fw_devlink is smart enough to know to wait for those devices to probe, so no special handling is required for those cases. Cc: Greg Kroah-Hartman <[email protected]> Reported-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/lkml/CACRpkdamxDX6EBVjKX5=D3rkHp17f5pwGdBVhzFU90-0MHY6dQ@mail.gmail.com/ Fixes: 4a03282 ("of: property: Simplify of_link_to_phandle()") Signed-off-by: Saravana Kannan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent fe15c26 commit c28cd1f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/linux/clk-provider.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,13 @@ struct clk_hw_onecell_data {
13631363
struct clk_hw *hws[];
13641364
};
13651365

1366-
#define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
1366+
#define CLK_OF_DECLARE(name, compat, fn) \
1367+
static void __init name##_of_clk_init_declare(struct device_node *np) \
1368+
{ \
1369+
fn(np); \
1370+
fwnode_dev_initialized(of_fwnode_handle(np), true); \
1371+
} \
1372+
OF_DECLARE_1(clk, name, compat, name##_of_clk_init_declare)
13671373

13681374
/*
13691375
* Use this macro when you have a driver that requires two initialization

0 commit comments

Comments
 (0)