linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "N. Coesel" <nico@nctdev.nl>
To: linux-kernel@vger.kernel.org
Subject: Cpufreq shutdown patch (kernel 2.6.35.3)
Date: Thu, 19 Jan 2012 22:18:10 +0100	[thread overview]
Message-ID: <CPSMTPM-CMT109lZGdO0011ecc5@CPSMTPM-CMT109.kpnxchange.com> (raw)

Dear readers,
I've found a problem in drivers/cpufreq/cpufreq.c. The driver does 
not execute the exit member of the low level driver when shutting 
down for a reboot (reset). This potentially leaves the power supply 
at a too low voltage to boot the system properly. The patch below 
adds a shutdown function which executes the exit member of the low 
level driver which allows a system to be properly prepared for a reset.

--- drivers/cpufreq/cpufreq.c.orig      2010-08-20 20:55:55.000000000 +0200
+++ drivers/cpufreq/cpufreq.c   2012-01-19 21:50:46.000000000 +0100
@@ -1431,11 +1431,34 @@ fail:
         return ret;
  }

+
+static int cpufreq_shutdown(struct sys_device *sysdev)
+{
+       struct cpufreq_policy *cpu_policy;
+       int cpu = sysdev->id;
+       int ret =0;
+
+       if (!cpu_online(cpu))
+               return 0;
+
+       cpu_policy = cpufreq_cpu_get(cpu);
+       if (!cpu_policy)
+               return -EINVAL;
+
+//     printk("cpufreq_shutdown %d \n", cpu);
+       if (cpufreq_driver->exit)
+               ret = cpufreq_driver->exit(cpu_policy);
+
+       return ret;
+}
+
+
  static struct sysdev_driver cpufreq_sysdev_driver = {
         .add            = cpufreq_add_dev,
         .remove         = cpufreq_remove_dev,
         .suspend        = cpufreq_suspend,
         .resume         = cpufreq_resume,
+       .shutdown = cpufreq_shutdown,
  };



Signed of by: Nico Coesel nico@nctdev.nl



             reply	other threads:[~2012-01-19 21:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-19 21:18 N. Coesel [this message]
2012-02-13 16:28 ` Cpufreq shutdown patch (kernel 2.6.35.3) Dave Jones
2012-02-13 16:35   ` Dave Jones
2012-02-14 14:03     ` Kay Sievers
2012-02-13 16:45   ` N. Coesel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CPSMTPM-CMT109lZGdO0011ecc5@CPSMTPM-CMT109.kpnxchange.com \
    --to=nico@nctdev.nl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).