diff for duplicates of <20151016125533.20687.23387@quantum> diff --git a/a/1.txt b/N1/1.txt index 1507a22..afe9da3 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,20 +1,18 @@ Cc'ing Geert. Quoting Stephen Boyd (2015-10-15 16:19:38) -> If a clock provider has #clock-cells =3D 1 and we call +> If a clock provider has #clock-cells = 1 and we call > of_clk_get_parent_name() on it we may end up returning the name > of the provider node if the provider doesn't have a > clock-output-names property. This doesn't make sense, especially > when you consider that calling of_clk_get_parent_name() on such a > node with different indices will return the same name each time. -> = - +> > Let's try getting the clock from the framework via of_clk_get() > instead, and only fallback to the node name if we have a provider -> with #clock-cells =3D 0. This way, we can't hand out the same name +> with #clock-cells = 0. This way, we can't hand out the same name > for different clocks when we don't actually know their names. -> = - +> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Geert, @@ -28,56 +26,48 @@ Mike > --- > drivers/clk/clk.c | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) -> = - +> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index b005f666e3a1..a0fe9ca1f0af 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c -> @@ -3055,6 +3055,7 @@ const char *of_clk_get_parent_name(struct device_no= -de *np, int index) +> @@ -3055,6 +3055,7 @@ const char *of_clk_get_parent_name(struct device_node *np, int index) > u32 pv; > int rc; > int count; > + struct clk *clk; -> = - +> > if (index < 0) > return NULL; -> @@ -3080,8 +3081,25 @@ const char *of_clk_get_parent_name(struct device_n= -ode *np, int index) -> = - -> if (of_property_read_string_index(clkspec.np, "clock-output-names= -", +> @@ -3080,8 +3081,25 @@ const char *of_clk_get_parent_name(struct device_node *np, int index) +> +> if (of_property_read_string_index(clkspec.np, "clock-output-names", > index, > - &clk_name) < 0) -> - clk_name =3D clkspec.np->name; +> - clk_name = clkspec.np->name; > + &clk_name) < 0) { > + /* > + * Best effort to get the name if the clock has been > + * registered with the framework. If the clock isn't > + * registered, we return the node name as the name of -> + * the clock as long as #clock-cells =3D 0. +> + * the clock as long as #clock-cells = 0. > + */ -> + clk =3D of_clk_get_from_provider(&clkspec); +> + clk = of_clk_get_from_provider(&clkspec); > + if (IS_ERR(clk)) { -> + if (clkspec.args_count =3D=3D 0) -> + clk_name =3D clkspec.np->name; +> + if (clkspec.args_count == 0) +> + clk_name = clkspec.np->name; > + else -> + clk_name =3D NULL; +> + clk_name = NULL; > + } else { -> + clk_name =3D __clk_get_name(clk); +> + clk_name = __clk_get_name(clk); > + clk_put(clk); > + } > + } > + -> = - +> > of_node_put(clkspec.np); > return clk_name; -> -- = - +> -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project ->=20 +> diff --git a/a/content_digest b/N1/content_digest index 7c14422..07dedb5 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -18,20 +18,18 @@ "Cc'ing Geert.\n" "\n" "Quoting Stephen Boyd (2015-10-15 16:19:38)\n" - "> If a clock provider has #clock-cells =3D 1 and we call\n" + "> If a clock provider has #clock-cells = 1 and we call\n" "> of_clk_get_parent_name() on it we may end up returning the name\n" "> of the provider node if the provider doesn't have a\n" "> clock-output-names property. This doesn't make sense, especially\n" "> when you consider that calling of_clk_get_parent_name() on such a\n" "> node with different indices will return the same name each time.\n" - "> =\n" - "\n" + "> \n" "> Let's try getting the clock from the framework via of_clk_get()\n" "> instead, and only fallback to the node name if we have a provider\n" - "> with #clock-cells =3D 0. This way, we can't hand out the same name\n" + "> with #clock-cells = 0. This way, we can't hand out the same name\n" "> for different clocks when we don't actually know their names.\n" - "> =\n" - "\n" + "> \n" "> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>\n" "\n" "Geert,\n" @@ -45,58 +43,50 @@ "> ---\n" "> drivers/clk/clk.c | 22 ++++++++++++++++++++--\n" "> 1 file changed, 20 insertions(+), 2 deletions(-)\n" - "> =\n" - "\n" + "> \n" "> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c\n" "> index b005f666e3a1..a0fe9ca1f0af 100644\n" "> --- a/drivers/clk/clk.c\n" "> +++ b/drivers/clk/clk.c\n" - "> @@ -3055,6 +3055,7 @@ const char *of_clk_get_parent_name(struct device_no=\n" - "de *np, int index)\n" + "> @@ -3055,6 +3055,7 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)\n" "> u32 pv;\n" "> int rc;\n" "> int count;\n" "> + struct clk *clk;\n" - "> =\n" - "\n" + "> \n" "> if (index < 0)\n" "> return NULL;\n" - "> @@ -3080,8 +3081,25 @@ const char *of_clk_get_parent_name(struct device_n=\n" - "ode *np, int index)\n" - "> =\n" - "\n" - "> if (of_property_read_string_index(clkspec.np, \"clock-output-names=\n" - "\",\n" + "> @@ -3080,8 +3081,25 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)\n" + "> \n" + "> if (of_property_read_string_index(clkspec.np, \"clock-output-names\",\n" "> index,\n" "> - &clk_name) < 0)\n" - "> - clk_name =3D clkspec.np->name;\n" + "> - clk_name = clkspec.np->name;\n" "> + &clk_name) < 0) {\n" "> + /*\n" "> + * Best effort to get the name if the clock has been\n" "> + * registered with the framework. If the clock isn't\n" "> + * registered, we return the node name as the name of\n" - "> + * the clock as long as #clock-cells =3D 0.\n" + "> + * the clock as long as #clock-cells = 0.\n" "> + */\n" - "> + clk =3D of_clk_get_from_provider(&clkspec);\n" + "> + clk = of_clk_get_from_provider(&clkspec);\n" "> + if (IS_ERR(clk)) {\n" - "> + if (clkspec.args_count =3D=3D 0)\n" - "> + clk_name =3D clkspec.np->name;\n" + "> + if (clkspec.args_count == 0)\n" + "> + clk_name = clkspec.np->name;\n" "> + else\n" - "> + clk_name =3D NULL;\n" + "> + clk_name = NULL;\n" "> + } else {\n" - "> + clk_name =3D __clk_get_name(clk);\n" + "> + clk_name = __clk_get_name(clk);\n" "> + clk_put(clk);\n" "> + }\n" "> + }\n" "> +\n" - "> =\n" - "\n" + "> \n" "> of_node_put(clkspec.np);\n" "> return clk_name;\n" - "> -- =\n" - "\n" + "> -- \n" "> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\n" "> a Linux Foundation Collaborative Project\n" - >=20 + > -ac025b1d223b3cea1686cb868b8cccf8391375e71615276d32bb2e114b76d245 +5c396a6577de155d39792c0662af88a0825435a21325fff57b773cba258fa260
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.