diff mbox

s5pv210-cpufreq: fix wrong do_div() usage

Message ID alpine.LFD.2.20.1511031706460.630@knanqh.ubzr
State New
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

Viresh Kumar Nov. 4, 2015, 1:50 a.m. UTC | #1
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
--
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);
 }