diff mbox

[2/2] clk: shmobile: clk-mstp: add backwards comapt for indices field

Message ID 1394196400-17112-3-git-send-email-ben.dooks@codethink.co.uk (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Ben Dooks March 7, 2014, 12:46 p.m. UTC
Add comaptibiltiy for older device trees by checking to see if
the clock-indices property is there and falling back to the
older renesas,clock-indices field.

This can be removed once all device-trees are converted.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 drivers/clk/shmobile/clk-mstp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart March 7, 2014, 5:26 p.m. UTC | #1
Hi Ben,

Thank you for the patch.

On Friday 07 March 2014 12:46:40 Ben Dooks wrote:
> Add comaptibiltiy for older device trees by checking to see if
> the clock-indices property is there and falling back to the
> older renesas,clock-indices field.
> 
> This can be removed once all device-trees are converted.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c
> b/drivers/clk/shmobile/clk-mstp.c index 95a2aa7..fe63d40 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -156,6 +156,7 @@ cpg_mstp_clock_register(const char *name, const char
> *parent_name, static void __init cpg_mstp_clocks_init(struct device_node
> *np)
>  {
>  	struct mstp_clock_group *group;
> +	const char *idxname;
>  	struct clk **clks;
>  	unsigned int i;
> 
> @@ -184,6 +185,11 @@ static void __init cpg_mstp_clocks_init(struct
> device_node *np) for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
>  		clks[i] = ERR_PTR(-ENOENT);
> 
> +	if (of_find_property(np, "clock-indices", &i))

You can leave the last argument NULL.

> +		idxname = "clock-indices";
> +	else
> +		idxname = "renesas,clock-indices";
> +
>  	for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
>  		const char *parent_name;
>  		const char *name;
> @@ -197,8 +203,7 @@ static void __init cpg_mstp_clocks_init(struct
> device_node *np) continue;
> 
>  		parent_name = of_clk_get_parent_name(np, i);
> -		ret = of_property_read_u32_index(np, "clock-indices", i,
> -						 &clkidx);
> +		ret = of_property_read_u32_index(np, idxname, i, &clkidx);
>  		if (parent_name == NULL || ret < 0)
>  			break;
Mark Rutland March 10, 2014, 10:51 a.m. UTC | #2
On Fri, Mar 07, 2014 at 12:46:40PM +0000, Ben Dooks wrote:
> Add comaptibiltiy for older device trees by checking to see if
> the clock-indices property is there and falling back to the
> older renesas,clock-indices field.

Why are these two separate patches? This temporarily breaks
compatibility.

> 
> This can be removed once all device-trees are converted.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
>  drivers/clk/shmobile/clk-mstp.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
> index 95a2aa7..fe63d40 100644
> --- a/drivers/clk/shmobile/clk-mstp.c
> +++ b/drivers/clk/shmobile/clk-mstp.c
> @@ -156,6 +156,7 @@ cpg_mstp_clock_register(const char *name, const char *parent_name,
>  static void __init cpg_mstp_clocks_init(struct device_node *np)
>  {
>  	struct mstp_clock_group *group;
> +	const char *idxname;
>  	struct clk **clks;
>  	unsigned int i;
>  
> @@ -184,6 +185,11 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
>  	for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
>  		clks[i] = ERR_PTR(-ENOENT);
>  
> +	if (of_find_property(np, "clock-indices", &i))

s/&i/NULL/ (or use of_property_read_bool).

Cheers,
Mark.

> +		idxname = "clock-indices";
> +	else
> +		idxname = "renesas,clock-indices";
> +
>  	for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
>  		const char *parent_name;
>  		const char *name;
> @@ -197,8 +203,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
>  			continue;
>  
>  		parent_name = of_clk_get_parent_name(np, i);
> -		ret = of_property_read_u32_index(np, "clock-indices", i,
> -						 &clkidx);
> +		ret = of_property_read_u32_index(np, idxname, i, &clkidx);
>  		if (parent_name == NULL || ret < 0)
>  			break;
>  
> -- 
> 1.9.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Dooks March 10, 2014, 11:10 a.m. UTC | #3
On 10/03/14 10:51, Mark Rutland wrote:
> On Fri, Mar 07, 2014 at 12:46:40PM +0000, Ben Dooks wrote:
>> Add comaptibiltiy for older device trees by checking to see if
>> the clock-indices property is there and falling back to the
>> older renesas,clock-indices field.
>
> Why are these two separate patches? This temporarily breaks
> compatibility.

Given I've not had time to change any of the device trees
for the renesas series it isn't currently an issue.

I left it separate to make it easier to remove once the changes
are through.
Geert Uytterhoeven April 15, 2014, 9:10 a.m. UTC | #4
Hi Ben,

On Fri, Mar 7, 2014 at 1:46 PM, Ben Dooks <ben.dooks@codethink.co.uk> wrote:
> Add comaptibiltiy for older device trees by checking to see if

compatibility (also in the subject line).

> the clock-indices property is there and falling back to the
> older renesas,clock-indices field.
>
> This can be removed once all device-trees are converted.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
index 95a2aa7..fe63d40 100644
--- a/drivers/clk/shmobile/clk-mstp.c
+++ b/drivers/clk/shmobile/clk-mstp.c
@@ -156,6 +156,7 @@  cpg_mstp_clock_register(const char *name, const char *parent_name,
 static void __init cpg_mstp_clocks_init(struct device_node *np)
 {
 	struct mstp_clock_group *group;
+	const char *idxname;
 	struct clk **clks;
 	unsigned int i;
 
@@ -184,6 +185,11 @@  static void __init cpg_mstp_clocks_init(struct device_node *np)
 	for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
 		clks[i] = ERR_PTR(-ENOENT);
 
+	if (of_find_property(np, "clock-indices", &i))
+		idxname = "clock-indices";
+	else
+		idxname = "renesas,clock-indices";
+
 	for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
 		const char *parent_name;
 		const char *name;
@@ -197,8 +203,7 @@  static void __init cpg_mstp_clocks_init(struct device_node *np)
 			continue;
 
 		parent_name = of_clk_get_parent_name(np, i);
-		ret = of_property_read_u32_index(np, "clock-indices", i,
-						 &clkidx);
+		ret = of_property_read_u32_index(np, idxname, i, &clkidx);
 		if (parent_name == NULL || ret < 0)
 			break;