diff mbox

s5pv210-cpufreq: fix wrong do_div() usage

Message ID alpine.LFD.2.20.1511031706460.630@knanqh.ubzr (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Nicolas Pitre Nov. 3, 2015, 10:13 p.m. UTC
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>

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Krzysztof Kozlowski Nov. 4, 2015, 12:41 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Nov. 4, 2015, 1:50 a.m. UTC | #2
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>
Rafael J. Wysocki Nov. 5, 2015, 10:34 p.m. UTC | #3
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

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" 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/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);
 }