Re: 2.6.12-rc3 cpufreq compile error on ppc32

2005-04-29 Thread Andrew Morton
Christoph Hellwig <[EMAIL PROTECTED]> wrote:
>
> On Mon, Apr 25, 2005 at 10:20:39PM +0200, Colin Leroy wrote:
>  > > > One of Ben's patches ("ppc32: Fix cpufreq problems") went in 2.6.12-
>  > > > rc3, but it depended on another patch that's still in -mm only: 
>  > > > add-suspend-method-to-cpufreq-core.patch
>  > > > 
>  > > > In addition to this, there's a third patch in -mm that fixes
>  > > > warnings and line length to the previous patch, but it doesn't
>  > > > apply cleanly anymore. It's named add-suspend-method-to-cpufreq-
>  > > > core-warning-fix.patch
>  > > 
>  > > Yup, please, Andrew, get those 2 to Linus.
>  > 
>  > Just a heads-up : I didn't see these go into the git tree?
> 
>  still not in.  Linus, can you please put in the patch below from benh?
> 
> 
>  Index: linux-work/drivers/cpufreq/cpufreq.c

This patch is missing a warning fix.  I'll send the correct one.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: 2.6.12-rc3 cpufreq compile error on ppc32

2005-04-29 Thread Christoph Hellwig
On Mon, Apr 25, 2005 at 10:20:39PM +0200, Colin Leroy wrote:
> > > One of Ben's patches ("ppc32: Fix cpufreq problems") went in 2.6.12-
> > > rc3, but it depended on another patch that's still in -mm only: 
> > > add-suspend-method-to-cpufreq-core.patch
> > > 
> > > In addition to this, there's a third patch in -mm that fixes
> > > warnings and line length to the previous patch, but it doesn't
> > > apply cleanly anymore. It's named add-suspend-method-to-cpufreq-
> > > core-warning-fix.patch
> > 
> > Yup, please, Andrew, get those 2 to Linus.
> 
> Just a heads-up : I didn't see these go into the git tree?

still not in.  Linus, can you please put in the patch below from benh?


Index: linux-work/drivers/cpufreq/cpufreq.c
===
--- linux-work.orig/drivers/cpufreq/cpufreq.c   2005-03-30 09:42:18.0 
+1000
+++ linux-work/drivers/cpufreq/cpufreq.c2005-03-30 09:47:22.0 
+1000
@@ -223,7 +223,7 @@
}
if ((val == CPUFREQ_PRECHANGE  && ci->old < ci->new) ||
(val == CPUFREQ_POSTCHANGE && ci->old > ci->new) ||
-   (val == CPUFREQ_RESUMECHANGE)) {
+   (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) {
loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, 
ci->new);
dprintk("scaling loops_per_jiffy to %lu for frequency %u 
kHz\n", loops_per_jiffy, ci->new);
}
@@ -866,16 +866,96 @@
 
 
 /**
+ * cpufreq_suspend - let the low level driver prepare for suspend
+ */
+
+static int cpufreq_suspend(struct sys_device * sysdev, u32 state)
+{
+   int cpu = sysdev->id;
+   unsigned int ret = 0;
+   unsigned int cur_freq = 0;
+   struct cpufreq_policy *cpu_policy;
+
+   dprintk("resuming cpu %u\n", cpu);
+
+   if (!cpu_online(cpu))
+   return 0;
+
+   /* we may be lax here as interrupts are off. Nonetheless
+* we need to grab the correct cpu policy, as to check
+* whether we really run on this CPU.
+*/
+
+   cpu_policy = cpufreq_cpu_get(cpu);
+   if (!cpu_policy)
+   return -EINVAL;
+
+   /* only handle each CPU group once */
+   if (unlikely(cpu_policy->cpu != cpu)) {
+   cpufreq_cpu_put(cpu_policy);
+   return 0;
+   }
+
+   if (cpufreq_driver->suspend) {
+   ret = cpufreq_driver->suspend(cpu_policy, state);
+   if (ret) {
+   printk(KERN_ERR "cpufreq: suspend failed in ->suspend "
+   "step on CPU %u\n", cpu_policy->cpu);
+   cpufreq_cpu_put(cpu_policy);
+   return ret;
+   }
+   }
+
+
+   if (cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)
+   goto out;
+
+   if (cpufreq_driver->get)
+   cur_freq = cpufreq_driver->get(cpu_policy->cpu);
+
+   if (!cur_freq || !cpu_policy->cur) {
+   printk(KERN_ERR "cpufreq: suspend failed to assert current "
+  "frequency is what timing core thinks it is.\n");
+   goto out;
+   }
+
+   if (unlikely(cur_freq != cpu_policy->cur)) {
+   struct cpufreq_freqs freqs;
+
+   if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN))
+   printk(KERN_DEBUG "Warning: CPU frequency is %u, "
+  "cpufreq assumed %u kHz.\n",
+  cur_freq, cpu_policy->cur);
+
+   freqs.cpu = cpu;
+   freqs.old = cpu_policy->cur;
+   freqs.new = cur_freq;
+
+   notifier_call_chain(&cpufreq_transition_notifier_list,
+   CPUFREQ_SUSPENDCHANGE, &freqs);
+   adjust_jiffies(CPUFREQ_SUSPENDCHANGE, &freqs);
+
+   cpu_policy->cur = cur_freq;
+   }
+
+ out:
+   cpufreq_cpu_put(cpu_policy);
+   return 0;
+}
+
+/**
  * cpufreq_resume -  restore proper CPU frequency handling after resume
  *
  * 1.) resume CPUfreq hardware support (cpufreq_driver->resume())
  * 2.) if ->target and !CPUFREQ_CONST_LOOPS: verify we're in sync
- * 3.) schedule call cpufreq_update_policy() ASAP as interrupts are 
restored.
+ * 3.) schedule call cpufreq_update_policy() ASAP as interrupts are
+ * restored.
  */
 static int cpufreq_resume(struct sys_device * sysdev)
 {
int cpu = sysdev->id;
unsigned int ret = 0;
+   unsigned int cur_freq = 0;
struct cpufreq_policy *cpu_policy;
 
dprintk("resuming cpu %u\n", cpu);
@@ -908,32 +988,34 @@
}
}
 
-   if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
-   unsigned int cur_freq = 0;
-
-   if (cpufreq_driver->get)
-   cur_freq = cpufreq_driver->get(cpu_policy->cpu);
-
-   if (!cur_freq || !cpu_policy->cur) {
-   printk(KERN_ERR

Re: 2.6.12-rc3 cpufreq compile error on ppc32

2005-04-25 Thread Colin Leroy
On 22 Apr 2005 at 10h04, Benjamin Herrenschmidt wrote:

Hi, 

> > 
> > One of Ben's patches ("ppc32: Fix cpufreq problems") went in 2.6.12-
> > rc3, but it depended on another patch that's still in -mm only: 
> > add-suspend-method-to-cpufreq-core.patch
> > 
> > In addition to this, there's a third patch in -mm that fixes
> > warnings and line length to the previous patch, but it doesn't
> > apply cleanly anymore. It's named add-suspend-method-to-cpufreq-
> > core-warning-fix.patch
> 
> Yup, please, Andrew, get those 2 to Linus.

Just a heads-up : I didn't see these go into the git tree?

-- 
Colin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: 2.6.12-rc3 cpufreq compile error on ppc32

2005-04-21 Thread Benjamin Herrenschmidt
On Thu, 2005-04-21 at 09:26 +0200, Colin Leroy wrote:
> Hi guys,
> 
> One of Ben's patches ("ppc32: Fix cpufreq problems") went in 2.6.12-
> rc3, but it depended on another patch that's still in -mm only: 
> add-suspend-method-to-cpufreq-core.patch
> 
> In addition to this, there's a third patch in -mm that fixes warnings
> and line length to the previous patch, but it doesn't apply cleanly
> anymore. It's named add-suspend-method-to-cpufreq-core-warning-fix.patch

Yup, please, Andrew, get those 2 to Linus.

Ben.

> Here's an updated version. HTH,
> 
> Signed-off-by: Colin Leroy <[EMAIL PROTECTED]>
> --- a/drivers/cpufreq/cpufreq.c   2005-04-21 09:14:28.0 +0200
> +++ b/drivers/cpufreq/cpufreq.c   2005-04-21 09:18:11.0 +0200
> @@ -955,7 +955,6 @@
>  {
>   int cpu = sysdev->id;
>   unsigned int ret = 0;
> - unsigned int cur_freq = 0;
>   struct cpufreq_policy *cpu_policy;
>  
>   dprintk("resuming cpu %u\n", cpu);
> @@ -995,21 +994,24 @@
>   cur_freq = cpufreq_driver->get(cpu_policy->cpu);
>  
>   if (!cur_freq || !cpu_policy->cur) {
> - printk(KERN_ERR "cpufreq: resume failed to assert 
> current frequency is what timing core thinks it is.\n");
> + printk(KERN_ERR "cpufreq: resume failed to assert "
> + "current frequency is what timing core "
> + "thinks it is.\n");
>   goto out;
>   }
>  
>   if (unlikely(cur_freq != cpu_policy->cur)) {
>   struct cpufreq_freqs freqs;
>  
> - printk(KERN_WARNING "Warning: CPU frequency is %u, "
> -"cpufreq assumed %u kHz.\n", cur_freq, 
> cpu_policy->cur);
> + printk(KERN_WARNING "Warning: CPU frequency is %u, 
> cpufreq assumed "
> + "%u kHz.\n", cur_freq, 
> cpu_policy->cur);
>  
>   freqs.cpu = cpu;
>   freqs.old = cpu_policy->cur;
>   freqs.new = cur_freq;
>  
> - notifier_call_chain(&cpufreq_transition_notifier_list, 
> CPUFREQ_RESUMECHANGE, &freqs);
> + notifier_call_chain(&cpufreq_transition_notifier_list,
> + CPUFREQ_RESUMECHANGE, &freqs);
>   adjust_jiffies(CPUFREQ_RESUMECHANGE, &freqs);
>  
>   cpu_policy->cur = cur_freq;
> 
> 
-- 
Benjamin Herrenschmidt <[EMAIL PROTECTED]>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



2.6.12-rc3 cpufreq compile error on ppc32

2005-04-21 Thread Colin Leroy
Hi guys,

One of Ben's patches ("ppc32: Fix cpufreq problems") went in 2.6.12-
rc3, but it depended on another patch that's still in -mm only: 
add-suspend-method-to-cpufreq-core.patch

In addition to this, there's a third patch in -mm that fixes warnings
and line length to the previous patch, but it doesn't apply cleanly
anymore. It's named add-suspend-method-to-cpufreq-core-warning-fix.patch

Here's an updated version. HTH,

Signed-off-by: Colin Leroy <[EMAIL PROTECTED]>
--- a/drivers/cpufreq/cpufreq.c 2005-04-21 09:14:28.0 +0200
+++ b/drivers/cpufreq/cpufreq.c 2005-04-21 09:18:11.0 +0200
@@ -955,7 +955,6 @@
 {
int cpu = sysdev->id;
unsigned int ret = 0;
-   unsigned int cur_freq = 0;
struct cpufreq_policy *cpu_policy;
 
dprintk("resuming cpu %u\n", cpu);
@@ -995,21 +994,24 @@
cur_freq = cpufreq_driver->get(cpu_policy->cpu);
 
if (!cur_freq || !cpu_policy->cur) {
-   printk(KERN_ERR "cpufreq: resume failed to assert 
current frequency is what timing core thinks it is.\n");
+   printk(KERN_ERR "cpufreq: resume failed to assert "
+   "current frequency is what timing core "
+   "thinks it is.\n");
goto out;
}
 
if (unlikely(cur_freq != cpu_policy->cur)) {
struct cpufreq_freqs freqs;
 
-   printk(KERN_WARNING "Warning: CPU frequency is %u, "
-  "cpufreq assumed %u kHz.\n", cur_freq, 
cpu_policy->cur);
+   printk(KERN_WARNING "Warning: CPU frequency is %u, 
cpufreq assumed "
+   "%u kHz.\n", cur_freq, 
cpu_policy->cur);
 
freqs.cpu = cpu;
freqs.old = cpu_policy->cur;
freqs.new = cur_freq;
 
-   notifier_call_chain(&cpufreq_transition_notifier_list, 
CPUFREQ_RESUMECHANGE, &freqs);
+   notifier_call_chain(&cpufreq_transition_notifier_list,
+   CPUFREQ_RESUMECHANGE, &freqs);
adjust_jiffies(CPUFREQ_RESUMECHANGE, &freqs);
 
cpu_policy->cur = cur_freq;


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]