]>
Commit | Line | Data |
---|---|---|
47f38bc9 GKH |
1 | From foo@baz Fri Sep 21 09:36:02 CEST 2018 |
2 | From: Rajan Vaja <rajan.vaja@xilinx.com> | |
3 | Date: Tue, 17 Jul 2018 06:17:00 -0700 | |
4 | Subject: clk: clk-fixed-factor: Clear OF_POPULATED flag in case of failure | |
5 | ||
6 | From: Rajan Vaja <rajan.vaja@xilinx.com> | |
7 | ||
8 | [ Upstream commit f6dab4233d6b64d719109040503b567f71fbfa01 ] | |
9 | ||
10 | Fixed factor clock has two initializations at of_clk_init() time | |
11 | and during platform driver probe. Before of_clk_init() call, | |
12 | node is marked as populated and so its probe never gets called. | |
13 | ||
14 | During of_clk_init() fixed factor clock registration may fail if | |
15 | any of its parent clock is not registered. In this case, it doesn't | |
16 | get chance to retry registration from probe. Clear OF_POPULATED | |
17 | flag if fixed factor clock registration fails so that clock | |
18 | registration is attempted again from probe. | |
19 | ||
20 | Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> | |
21 | Signed-off-by: Stephen Boyd <sboyd@kernel.org> | |
22 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
23 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
24 | --- | |
25 | drivers/clk/clk-fixed-factor.c | 9 ++++++++- | |
26 | 1 file changed, 8 insertions(+), 1 deletion(-) | |
27 | ||
28 | --- a/drivers/clk/clk-fixed-factor.c | |
29 | +++ b/drivers/clk/clk-fixed-factor.c | |
30 | @@ -177,8 +177,15 @@ static struct clk *_of_fixed_factor_clk_ | |
31 | ||
32 | clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags, | |
33 | mult, div); | |
34 | - if (IS_ERR(clk)) | |
35 | + if (IS_ERR(clk)) { | |
36 | + /* | |
37 | + * If parent clock is not registered, registration would fail. | |
38 | + * Clear OF_POPULATED flag so that clock registration can be | |
39 | + * attempted again from probe function. | |
40 | + */ | |
41 | + of_node_clear_flag(node, OF_POPULATED); | |
42 | return clk; | |
43 | + } | |
44 | ||
45 | ret = of_clk_add_provider(node, of_clk_src_simple_get, clk); | |
46 | if (ret) { |