Skip to contentSkip to conversation

Fix implicit declarations in ondemand.

CPUFREQ Dave Jones 4 participants 8 messages Jul 5, 2006 CPU frequency scaling framework

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration of function ‘jiffies64_to_cputime64’ drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration of function ‘cputime64_sub’

drivers/cpufreq/cpufreq_ondemand.c renamed from drivers/cpufreq/cpufreq_ondemand.c~ +1 -0
@@ -18,6 +18,7 @@
 #include <linux/jiffies.h>
 #include <linux/kernel_stat.h>
 #include <linux/mutex.h>
+#include <asm/cputime.h>
 
 /*
  * dbs is used in this file as a shortform for demandbased switching
Signature · 1 line
http://www.codemonkey.org.uk
#1 lore raw
Quoted 9 lines · On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <[email protected]> wrote:

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration of function ‘jiffies64_to_cputime64’ drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration of function ‘cputime64_sub’

drivers/cpufreq/cpufreq_ondemand.c line 22

Quoted 5 lines
drivers/cpufreq/cpufreq_ondemand.c renamed from drivers/cpufreq/cpufreq_ondemand.c~ +1 -0
@@ -18,6 +18,7 @@
 #include <linux/jiffies.h>
 #include <linux/kernel_stat.h>
 #include <linux/mutex.h>
+#include <asm/cputime.h>
 

But kernel_stat.h already includes cputime.h, as does sched.h, and pretty much everything pulls in sched.h.

It's not bad to avoid a dependency upon nested includes, but I do wonder how this error came about??

author
#2 lore raw
Quoted 21 lines · Andrew Morton
Quoted 9 lines · On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <[email protected]> wrote:

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration of function ‘jiffies64_to_cputime64’ drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration of function ‘cputime64_sub’

drivers/cpufreq/cpufreq_ondemand.c line 22

Quoted 5 lines
drivers/cpufreq/cpufreq_ondemand.c renamed from drivers/cpufreq/cpufreq_ondemand.c~ +1 -0
@@ -18,6 +18,7 @@
 #include <linux/jiffies.h>
 #include <linux/kernel_stat.h>
 #include <linux/mutex.h>
+#include <asm/cputime.h>
 

But kernel_stat.h already includes cputime.h, as does sched.h, and pretty much everything pulls in sched.h.

Quoted 2 lines

It's not bad to avoid a dependency upon nested includes, but I do wonder how this error came about??

Yeah, this is the wrong fix. Turns out it blew up on ppc64, which doesn't have those functions in its cputime.h

hrmph.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#3 lore raw
In reply to Andrew Morton
Quoted 8 lines · Andrew Morton
Quoted 2 lines · On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <[email protected]> wrote:

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration

of function ‘jiffies64_to_cputime64’

Quoted 1 line

drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration

of function ‘cputime64_sub’

Quoted 7 lines
Quoted 1 line

+#include <asm/cputime.h>

But kernel_stat.h already includes cputime.h, as does sched.h, and pretty much everything pulls in sched.h.

It's not bad to avoid a dependency upon nested includes, but I do wonder how this error came about??

asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or cputime64_sub()

Signature · 1 line
dwmw2
author
#4 lore raw
Quoted 11 lines · David Woodhouse
Quoted 9 lines · Andrew Morton
Quoted 2 lines · On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <[email protected]> wrote:

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration

of function ‘jiffies64_to_cputime64’

Quoted 1 line

drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration

of function ‘cputime64_sub’

Quoted 1 line

+#include <asm/cputime.h>

Quoted 8 lines
Quoted 5 lines

But kernel_stat.h already includes cputime.h, as does sched.h, and pretty much everything pulls in sched.h.

It's not bad to avoid a dependency upon nested includes, but I do wonder how this error came about??

asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or cputime64_sub()

The curious part is why it isn't picking up the definition from asm-generic like x86-64 & friends do.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#5 lore raw
Quoted 15 lines · On Wed, 5 Jul 2006 05:46:57 -0400 Dave Jones <[email protected]> wrote:
Quoted 14 lines · David Woodhouse
Quoted 13 lines · Andrew Morton
Quoted 2 lines · On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <[email protected]> wrote:

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration

of function ‘jiffies64_to_cputime64’

Quoted 1 line

drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration

of function ‘cputime64_sub’

Quoted 1 line

+#include <asm/cputime.h>

But kernel_stat.h already includes cputime.h, as does sched.h, and pretty much everything pulls in sched.h.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

It's not bad to avoid a dependency upon nested includes, but I do wonder how this error came about??

asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or cputime64_sub()

The curious part is why it isn't picking up the definition from asm-generic like x86-64 & friends do.

CONFIG_VIRT_CPU_ACCOUNTING.

#6 lore raw
Quoted 21 lines · Andrew Morton
Quoted 18 lines · On Wed, 5 Jul 2006 05:46:57 -0400 Dave Jones <[email protected]> wrote:
Quoted 17 lines · David Woodhouse
Quoted 15 lines · Andrew Morton
Quoted 2 lines · On Wed, 5 Jul 2006 05:22:54 -0400 Dave Jones <[email protected]> wrote:

drivers/cpufreq/cpufreq_ondemand.c: In function ‘dbs_check_cpu’:
drivers/cpufreq/cpufreq_ondemand.c:238: error: implicit declaration

of function ‘jiffies64_to_cputime64’

Quoted 1 line

drivers/cpufreq/cpufreq_ondemand.c:239: error: implicit declaration

of function ‘cputime64_sub’

Quoted 1 line

+#include <asm/cputime.h>

But kernel_stat.h already includes cputime.h, as does sched.h, and pretty much everything pulls in sched.h.

It's not bad to avoid a dependency upon nested includes, but I do wonder how this error came about??

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

asm-powerpc/cputime.h doesn't declare jiffies64_to_cputime64() or cputime64_sub()

The curious part is why it isn't picking up the definition from asm-generic like x86-64 & friends do.

CONFIG_VIRT_CPU_ACCOUNTING.

include/asm-powerpc/cputime.h renamed from include/asm-powerpc/cputime.h~ +18 -0
@@ -43,6 +43,7 @@ typedef u64 cputime64_t;
 
 #define cputime64_zero			((cputime64_t)0)
 #define cputime64_add(__a, __b)		((__a) + (__b))
+#define cputime64_sub(__a, __b)		((__a) - (__b))
 #define cputime_to_cputime64(__ct)	(__ct)
 
 #ifdef __KERNEL__
@@ -74,6 +75,23 @@ static inline cputime_t jiffies_to_cputi
 	return ct;
 }
 
+static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
+{
+	cputime_t ct;
+	u64 sec;
+
+	/* have to be a little careful about overflow */
+	ct = jif % HZ;
+	sec = jif / HZ;
+	if (ct) {
+		ct *= tb_ticks_per_sec;
+		do_div(ct, HZ);
+	}
+	if (sec)
+		ct += (cputime_t) sec * tb_ticks_per_sec;
+	return ct;
+}
+
 static inline u64 cputime64_to_jiffies64(const cputime_t ct)
 {
 	return mulhdu(ct, __cputime_jiffies_factor);
Signature · 1 line
dwmw2
#7 lore raw

include/asm-powerpc/cputime.h static inline cputime_t jiffies_to_cputi · line 85

Quoted 8 lines · David Woodhouse
include/asm-powerpc/cputime.h renamed from include/asm-powerpc/cputime.h~ +8 -0
+static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
+{
+	cputime_t ct;
+	u64 sec;
+
+	/* have to be a little careful about overflow */
+	ct = jif % HZ;
+	sec = jif / HZ;

I think we want to use do_div here, just in case we ever get around to implementing this stuff on ppc32.

Paul.