linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s5pv210-cpufreq: fix wrong do_div() usage
@ 2015-11-03 22:13 Nicolas Pitre
  2015-11-04  0:41 ` Krzysztof Kozlowski
  2015-11-04  1:50 ` Viresh Kumar
  0 siblings, 2 replies; 4+ messages in thread
From: Nicolas Pitre @ 2015-11-03 22:13 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar; +Cc: linux-pm

It is wrong to use do_div() with 32-bit dividends (unsigned long is
32 bits on 32-bit architectures).

Signed-off-by: Nicolas Pitre <nico@linaro.org>

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index 9e231f5215..051a8a8224 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -212,11 +212,11 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq)
 	/* Find current DRAM frequency */
 	tmp = s5pv210_dram_conf[ch].freq;
 
-	do_div(tmp, freq);
+	tmp /= freq;
 
 	tmp1 = s5pv210_dram_conf[ch].refresh;
 
-	do_div(tmp1, tmp);
+	tmp1 /= tmp;
 
 	__raw_writel(tmp1, reg);
 }

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

* Re: [PATCH] s5pv210-cpufreq: fix wrong do_div() usage
  2015-11-03 22:13 [PATCH] s5pv210-cpufreq: fix wrong do_div() usage Nicolas Pitre
@ 2015-11-04  0:41 ` Krzysztof Kozlowski
  2015-11-04  1:50 ` Viresh Kumar
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2015-11-04  0:41 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Rafael J. Wysocki, Viresh Kumar, linux-pm

2015-11-04 7:13 GMT+09:00 Nicolas Pitre <nicolas.pitre@linaro.org>:
> It is wrong to use do_div() with 32-bit dividends (unsigned long is
> 32 bits on 32-bit architectures).
>
> Signed-off-by: Nicolas Pitre <nico@linaro.org>
>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* Re: [PATCH] s5pv210-cpufreq: fix wrong do_div() usage
  2015-11-03 22:13 [PATCH] s5pv210-cpufreq: fix wrong do_div() usage Nicolas Pitre
  2015-11-04  0:41 ` Krzysztof Kozlowski
@ 2015-11-04  1:50 ` Viresh Kumar
  2015-11-05 22:34   ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2015-11-04  1:50 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Rafael J. Wysocki, linux-pm

On 03-11-15, 17:13, Nicolas Pitre wrote:
> It is wrong to use do_div() with 32-bit dividends (unsigned long is
> 32 bits on 32-bit architectures).
> 
> Signed-off-by: Nicolas Pitre <nico@linaro.org>
> 
> diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
> index 9e231f5215..051a8a8224 100644
> --- a/drivers/cpufreq/s5pv210-cpufreq.c
> +++ b/drivers/cpufreq/s5pv210-cpufreq.c
> @@ -212,11 +212,11 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq)
>  	/* Find current DRAM frequency */
>  	tmp = s5pv210_dram_conf[ch].freq;
>  
> -	do_div(tmp, freq);
> +	tmp /= freq;
>  
>  	tmp1 = s5pv210_dram_conf[ch].refresh;
>  
> -	do_div(tmp1, tmp);
> +	tmp1 /= tmp;
>  
>  	__raw_writel(tmp1, reg);
>  }

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

* Re: [PATCH] s5pv210-cpufreq: fix wrong do_div() usage
  2015-11-04  1:50 ` Viresh Kumar
@ 2015-11-05 22:34   ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2015-11-05 22:34 UTC (permalink / raw)
  To: Viresh Kumar, Nicolas Pitre; +Cc: linux-pm

On Wednesday, November 04, 2015 07:20:33 AM Viresh Kumar wrote:
> On 03-11-15, 17:13, Nicolas Pitre wrote:
> > It is wrong to use do_div() with 32-bit dividends (unsigned long is
> > 32 bits on 32-bit architectures).
> > 
> > Signed-off-by: Nicolas Pitre <nico@linaro.org>
> > 
> > diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
> > index 9e231f5215..051a8a8224 100644
> > --- a/drivers/cpufreq/s5pv210-cpufreq.c
> > +++ b/drivers/cpufreq/s5pv210-cpufreq.c
> > @@ -212,11 +212,11 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq)
> >  	/* Find current DRAM frequency */
> >  	tmp = s5pv210_dram_conf[ch].freq;
> >  
> > -	do_div(tmp, freq);
> > +	tmp /= freq;
> >  
> >  	tmp1 = s5pv210_dram_conf[ch].refresh;
> >  
> > -	do_div(tmp1, tmp);
> > +	tmp1 /= tmp;
> >  
> >  	__raw_writel(tmp1, reg);
> >  }
> 
> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

Applied, thanks!

Rafael


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

end of thread, other threads:[~2015-11-05 22:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-03 22:13 [PATCH] s5pv210-cpufreq: fix wrong do_div() usage Nicolas Pitre
2015-11-04  0:41 ` Krzysztof Kozlowski
2015-11-04  1:50 ` Viresh Kumar
2015-11-05 22:34   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).