diff mbox

ARM: OMAP2+: Fix bogus struct clk comparison for timer clock

Message ID 1430848941-27106-1-git-send-email-tony@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren May 5, 2015, 6:02 p.m. UTC
With recent changes to use determine_rate, the comparison of two
clocks won't work without doing __clk_get_hw on the clocks
first.

Cc: Michael Turquette <mturquette@linaro.org>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---

Found one more of these, the coccinelle scripts do not seem
to match this?

---
 arch/arm/mach-omap2/timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stephen Boyd May 6, 2015, 5:35 a.m. UTC | #1
On 05/05, Tony Lindgren wrote:
> With recent changes to use determine_rate, the comparison of two
> clocks won't work without doing __clk_get_hw on the clocks
> first.
> 
> Cc: Michael Turquette <mturquette@linaro.org>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Tero Kristo <t-kristo@ti.com>
> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> 
> Found one more of these, the coccinelle scripts do not seem
> to match this?

I don't think the coccinelle script was ever merged...

> 
> ---
>  arch/arm/mach-omap2/timer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
> index cef67af..22c7a8e 100644
> --- a/arch/arm/mach-omap2/timer.c
> +++ b/arch/arm/mach-omap2/timer.c
> @@ -35,6 +35,7 @@
>  #include <linux/irq.h>
>  #include <linux/clocksource.h>
>  #include <linux/clockchips.h>
> +#include <linux/clk-provider.h>
>  #include <linux/slab.h>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> @@ -298,7 +299,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
>  	if (IS_ERR(src))
>  		return PTR_ERR(src);
>  
> -	if (clk_get_parent(timer->fclk) != src) {
> +	if (__clk_get_hw(clk_get_parent(timer->fclk)) != __clk_get_hw(src)) {

Please use clk_is_match() instead so we can find these instances
with an easy grep.

>  		r = clk_set_parent(timer->fclk, src);
>  		if (r < 0) {
>  			pr_warn("%s: %s cannot set source\n", __func__,
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index cef67af..22c7a8e 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -35,6 +35,7 @@ 
 #include <linux/irq.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/clk-provider.h>
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -298,7 +299,7 @@  static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 	if (IS_ERR(src))
 		return PTR_ERR(src);
 
-	if (clk_get_parent(timer->fclk) != src) {
+	if (__clk_get_hw(clk_get_parent(timer->fclk)) != __clk_get_hw(src)) {
 		r = clk_set_parent(timer->fclk, src);
 		if (r < 0) {
 			pr_warn("%s: %s cannot set source\n", __func__,