public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.15-rc3] cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error
@ 2014-04-28 16:18 Tim Gardner
  2014-06-04 20:32 ` [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient Ed Swarthout
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Gardner @ 2014-04-28 16:18 UTC (permalink / raw)
  To: cpufreq, linux-pm, linux-kernel
  Cc: Tim Gardner, Rafael J. Wysocki, Viresh Kumar, Zhuoyu Zhang

bfa709bc823fc32ee8dd5220d1711b46078235d8 (cpufreq: powerpc: add cpufreq
transition latency for FSL e500mc SoCs) introduced a modpost error:

ERROR: "__udivdi3" [drivers/cpufreq/ppc-corenet-cpufreq.ko] undefined!
make[1]: *** [__modpost] Error 1

Fix this by avoiding 64 bit integer division.

gcc version 4.8.2

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Zhuoyu Zhang <Zhuoyu.Zhang@freescale.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/cpufreq/ppc-corenet-cpufreq.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c
index a1ca3dd..0af618a 100644
--- a/drivers/cpufreq/ppc-corenet-cpufreq.c
+++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
@@ -138,6 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	struct cpufreq_frequency_table *table;
 	struct cpu_data *data;
 	unsigned int cpu = policy->cpu;
+	u64 transition_latency_hz;
 
 	np = of_get_cpu_node(cpu, NULL);
 	if (!np)
@@ -205,8 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	for_each_cpu(i, per_cpu(cpu_mask, cpu))
 		per_cpu(cpu_data, i) = data;
 
+	transition_latency_hz = 12ULL * NSEC_PER_SEC;
 	policy->cpuinfo.transition_latency =
-				(12ULL * NSEC_PER_SEC) / fsl_get_sys_freq();
+		do_div(transition_latency_hz, fsl_get_sys_freq());
+
 	of_node_put(np);
 
 	return 0;
-- 
1.7.9.5


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

* [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient
  2014-04-28 16:18 [PATCH 3.15-rc3] cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error Tim Gardner
@ 2014-06-04 20:32 ` Ed Swarthout
  2014-06-06 14:03   ` Tim Gardner
  0 siblings, 1 reply; 3+ messages in thread
From: Ed Swarthout @ 2014-06-04 20:32 UTC (permalink / raw)
  To: tim.gardner, scottwood, linuxppc-dev, linux-kernel; +Cc: Ed Swarthout

6712d2931933ada259b82f06c03a855b19937074 (cpufreq:
ppc-corenet-cpufreq: Fix __udivdi3 modpost error) used the remainder
from do_div instead of the quotient. Fix that and add one to ensure
minimum is met.

Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---
 drivers/cpufreq/ppc-corenet-cpufreq.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c
index 0af618a..3607070 100644
--- a/drivers/cpufreq/ppc-corenet-cpufreq.c
+++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
@@ -138,7 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	struct cpufreq_frequency_table *table;
 	struct cpu_data *data;
 	unsigned int cpu = policy->cpu;
-	u64 transition_latency_hz;
+	u64 u64temp;
 
 	np = of_get_cpu_node(cpu, NULL);
 	if (!np)
@@ -206,9 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	for_each_cpu(i, per_cpu(cpu_mask, cpu))
 		per_cpu(cpu_data, i) = data;
 
-	transition_latency_hz = 12ULL * NSEC_PER_SEC;
-	policy->cpuinfo.transition_latency =
-		do_div(transition_latency_hz, fsl_get_sys_freq());
+	/* Minimum transition latency is 12 platform clocks */
+	u64temp = 12ULL * NSEC_PER_SEC;
+	do_div(u64temp, fsl_get_sys_freq());
+	policy->cpuinfo.transition_latency = u64temp + 1;
 
 	of_node_put(np);
 
-- 
1.9.1


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

* Re: [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient
  2014-06-04 20:32 ` [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient Ed Swarthout
@ 2014-06-06 14:03   ` Tim Gardner
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Gardner @ 2014-06-06 14:03 UTC (permalink / raw)
  To: Ed Swarthout, scottwood, linuxppc-dev, linux-kernel

On 06/04/2014 02:32 PM, Ed Swarthout wrote:
> 6712d2931933ada259b82f06c03a855b19937074 (cpufreq:
> ppc-corenet-cpufreq: Fix __udivdi3 modpost error) used the remainder
> from do_div instead of the quotient. Fix that and add one to ensure
> minimum is met.
> 
> Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
> ---
>  drivers/cpufreq/ppc-corenet-cpufreq.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c
> index 0af618a..3607070 100644
> --- a/drivers/cpufreq/ppc-corenet-cpufreq.c
> +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
> @@ -138,7 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	struct cpufreq_frequency_table *table;
>  	struct cpu_data *data;
>  	unsigned int cpu = policy->cpu;
> -	u64 transition_latency_hz;
> +	u64 u64temp;
>  
>  	np = of_get_cpu_node(cpu, NULL);
>  	if (!np)
> @@ -206,9 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	for_each_cpu(i, per_cpu(cpu_mask, cpu))
>  		per_cpu(cpu_data, i) = data;
>  
> -	transition_latency_hz = 12ULL * NSEC_PER_SEC;
> -	policy->cpuinfo.transition_latency =
> -		do_div(transition_latency_hz, fsl_get_sys_freq());
> +	/* Minimum transition latency is 12 platform clocks */
> +	u64temp = 12ULL * NSEC_PER_SEC;
> +	do_div(u64temp, fsl_get_sys_freq());
> +	policy->cpuinfo.transition_latency = u64temp + 1;
>  
>  	of_node_put(np);
>  
> 

Whoops, what was I thinking ? You should also add "Cc:
stable@vger.kernel.org # 3.15+" since this patch will likely miss 3.15
final.

Acked-by: Tim Gardner <tim.gardner@canonical.com>

-- 
Tim Gardner tim.gardner@canonical.com

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

end of thread, other threads:[~2014-06-06 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-28 16:18 [PATCH 3.15-rc3] cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error Tim Gardner
2014-06-04 20:32 ` [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient Ed Swarthout
2014-06-06 14:03   ` Tim Gardner

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