Re: [CPUFREQ] Fix implicit declarations in ondemand.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-07-05 at 02:57 -0700, Andrew Morton wrote:
> On Wed, 5 Jul 2006 05:46:57 -0400
> Dave Jones <[email protected]> wrote:
> 
> > On Wed, Jul 05, 2006 at 10:43:05AM +0100, David Woodhouse wrote:
> >  > On Wed, 2006-07-05 at 02:36 -0700, Andrew Morton wrote:
> >  > > 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’
> >  > 
> >  > > > +#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()
> > 
> > The curious part is why it isn't picking up the definition from asm-generic
> > like x86-64 & friends do.
> > 
> 
> CONFIG_VIRT_CPU_ACCOUNTING.

Signed-off-by: David Woodhouse <[email protected]>

--- linux-2.6.17.ppc64/include/asm-powerpc/cputime.h~	2006-06-18 02:49:35.000000000 +0100
+++ linux-2.6.17.ppc64/include/asm-powerpc/cputime.h	2006-07-05 11:19:35.000000000 +0100
@@ -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);

-- 
dwmw2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux