mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 3.9-stable] ARM: omap3: clock: fix wrong container_of in clock36xx.c
@ 2013-06-16 23:38 Jonghwan Choi
  2013-06-17  4:56 ` Paul Walmsley
  0 siblings, 1 reply; 2+ messages in thread
From: Jonghwan Choi @ 2013-06-16 23:38 UTC (permalink / raw)
  To: 'Jonghwan Choi', linux-kernel
  Cc: stable, 'Paul Walmsley', 'Jean-Philippe Francois'

This patch looks like it should be in the 3.9-stable tree, should we apply
it?

------------------

From: "Jean-Philippe Francois <jp.francois@cynove.com>"

commit a93d8a1cea0899982993e9a93404c6f78b123697 upstream

omap36xx_pwrdn_clk_enable_with_hsdiv_restore expects the parent hw of
the clock to be a clk_hw_omap. However, looking at cclock3xxx_data.c,
all concerned clock have parent defined as clk_divider.  Fix the
function to use clk_divider.  Tested with 3.9 on dm3730.

Signed-off-by: Jean-Philippe Francois <jp.francois@cynove.com>
Cc: NeilBrown <neilb@suse.de>
Cc: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
 arch/arm/mach-omap2/clock36xx.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/clock36xx.c
b/arch/arm/mach-omap2/clock36xx.c
index 8f3bf4e..bbd6a3f 100644
--- a/arch/arm/mach-omap2/clock36xx.c
+++ b/arch/arm/mach-omap2/clock36xx.c
@@ -20,11 +20,12 @@
 
 #include <linux/kernel.h>
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/io.h>
 
 #include "clock.h"
 #include "clock36xx.h"
-
+#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
 
 /**
  * omap36xx_pwrdn_clk_enable_with_hsdiv_restore - enable clocks suffering
@@ -39,29 +40,28 @@
  */
 int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
 {
-	struct clk_hw_omap *parent;
+	struct clk_divider *parent;
 	struct clk_hw *parent_hw;
-	u32 dummy_v, orig_v, clksel_shift;
+	u32 dummy_v, orig_v;
 	int ret;
 
 	/* Clear PWRDN bit of HSDIVIDER */
 	ret = omap2_dflt_clk_enable(clk);
 
 	parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
-	parent = to_clk_hw_omap(parent_hw);
+	parent = to_clk_divider(parent_hw);
 
 	/* Restore the dividers */
 	if (!ret) {
-		clksel_shift = __ffs(parent->clksel_mask);
-		orig_v = __raw_readl(parent->clksel_reg);
+		orig_v = __raw_readl(parent->reg);
 		dummy_v = orig_v;
 
 		/* Write any other value different from the Read value */
-		dummy_v ^= (1 << clksel_shift);
-		__raw_writel(dummy_v, parent->clksel_reg);
+		dummy_v ^= (1 << parent->shift);
+		__raw_writel(dummy_v, parent->reg);
 
 		/* Write the original divider */
-		__raw_writel(orig_v, parent->clksel_reg);
+		__raw_writel(orig_v, parent->reg);
 	}
 
 	return ret;
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 3.9-stable] ARM: omap3: clock: fix wrong container_of in clock36xx.c
  2013-06-16 23:38 [PATCH 3.9-stable] ARM: omap3: clock: fix wrong container_of in clock36xx.c Jonghwan Choi
@ 2013-06-17  4:56 ` Paul Walmsley
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2013-06-17  4:56 UTC (permalink / raw)
  To: Jonghwan Choi
  Cc: linux-kernel, neilb, linux-omap, mturquette, linux-arm-kernel,
	stable, 'Jean-Philippe Francois'

On Mon, 17 Jun 2013, Jonghwan Choi wrote:

> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Please do.


- Paul

> 
> ------------------
> 
> From: "Jean-Philippe Francois <jp.francois@cynove.com>"
> 
> commit a93d8a1cea0899982993e9a93404c6f78b123697 upstream
> 
> omap36xx_pwrdn_clk_enable_with_hsdiv_restore expects the parent hw of
> the clock to be a clk_hw_omap. However, looking at cclock3xxx_data.c,
> all concerned clock have parent defined as clk_divider.  Fix the
> function to use clk_divider.  Tested with 3.9 on dm3730.
> 
> Signed-off-by: Jean-Philippe Francois <jp.francois@cynove.com>
> Cc: NeilBrown <neilb@suse.de>
> Cc: Mike Turquette <mturquette@linaro.org>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
> ---
>  arch/arm/mach-omap2/clock36xx.c |   18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/clock36xx.c
> b/arch/arm/mach-omap2/clock36xx.c
> index 8f3bf4e..bbd6a3f 100644
> --- a/arch/arm/mach-omap2/clock36xx.c
> +++ b/arch/arm/mach-omap2/clock36xx.c
> @@ -20,11 +20,12 @@
>  
>  #include <linux/kernel.h>
>  #include <linux/clk.h>
> +#include <linux/clk-provider.h>
>  #include <linux/io.h>
>  
>  #include "clock.h"
>  #include "clock36xx.h"
> -
> +#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
>  
>  /**
>   * omap36xx_pwrdn_clk_enable_with_hsdiv_restore - enable clocks suffering
> @@ -39,29 +40,28 @@
>   */
>  int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
>  {
> -	struct clk_hw_omap *parent;
> +	struct clk_divider *parent;
>  	struct clk_hw *parent_hw;
> -	u32 dummy_v, orig_v, clksel_shift;
> +	u32 dummy_v, orig_v;
>  	int ret;
>  
>  	/* Clear PWRDN bit of HSDIVIDER */
>  	ret = omap2_dflt_clk_enable(clk);
>  
>  	parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
> -	parent = to_clk_hw_omap(parent_hw);
> +	parent = to_clk_divider(parent_hw);
>  
>  	/* Restore the dividers */
>  	if (!ret) {
> -		clksel_shift = __ffs(parent->clksel_mask);
> -		orig_v = __raw_readl(parent->clksel_reg);
> +		orig_v = __raw_readl(parent->reg);
>  		dummy_v = orig_v;
>  
>  		/* Write any other value different from the Read value */
> -		dummy_v ^= (1 << clksel_shift);
> -		__raw_writel(dummy_v, parent->clksel_reg);
> +		dummy_v ^= (1 << parent->shift);
> +		__raw_writel(dummy_v, parent->reg);
>  
>  		/* Write the original divider */
> -		__raw_writel(orig_v, parent->clksel_reg);
> +		__raw_writel(orig_v, parent->reg);
>  	}
>  
>  	return ret;
> -- 
> 1.7.9.5
> 


- Paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-17  4:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-16 23:38 [PATCH 3.9-stable] ARM: omap3: clock: fix wrong container_of in clock36xx.c Jonghwan Choi
2013-06-17  4:56 ` Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®