From: anton.vorontsov@linaro.org (Anton Vorontsov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ARM: Move leds idle start/stop calls to sched idle notifiers
Date: Wed, 8 Feb 2012 05:44:52 +0400 [thread overview]
Message-ID: <20120208014452.GD459@panacea> (raw)
In-Reply-To: <20120208013959.GA24535@panacea>
From: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
---
arch/arm/kernel/leds.c | 25 ++++++++++++++++++++++++-
arch/arm/kernel/process.c | 3 ---
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/arch/arm/kernel/leds.c b/arch/arm/kernel/leds.c
index 1911dae..fbc30d4 100644
--- a/arch/arm/kernel/leds.c
+++ b/arch/arm/kernel/leds.c
@@ -9,6 +9,8 @@
*/
#include <linux/export.h>
#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/notifier.h>
#include <linux/device.h>
#include <linux/syscore_ops.h>
#include <linux/string.h>
@@ -103,6 +105,25 @@ static struct syscore_ops leds_syscore_ops = {
.resume = leds_resume,
};
+static int leds_idle_notifier(struct notifier_block *nb, unsigned long val,
+ void *data)
+{
+ switch (val) {
+ case SCHED_IDLE_START:
+ leds_event(led_idle_start);
+ break;
+ case SCHED_IDLE_END:
+ leds_event(led_idle_end);
+ break;
+ }
+
+ return 0;
+}
+
+static struct notifier_block leds_idle_nb = {
+ .notifier_call = leds_idle_notifier,
+};
+
static int __init leds_init(void)
{
int ret;
@@ -111,8 +132,10 @@ static int __init leds_init(void)
ret = device_register(&leds_device);
if (ret == 0)
ret = device_create_file(&leds_device, &dev_attr_event);
- if (ret == 0)
+ if (ret == 0) {
register_syscore_ops(&leds_syscore_ops);
+ sched_idle_notifier_register(&leds_idle_nb);
+ }
return ret;
}
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index f2bac2d..f4b53aa 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -33,7 +33,6 @@
#include <linux/cpuidle.h>
#include <asm/cacheflush.h>
-#include <asm/leds.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/thread_notify.h>
@@ -207,7 +206,6 @@ void cpu_idle(void)
/* endless idle loop with no priority at all */
while (1) {
sched_idle_enter();
- leds_event(led_idle_start);
while (!need_resched()) {
#ifdef CONFIG_HOTPLUG_CPU
if (cpu_is_offline(smp_processor_id()))
@@ -235,7 +233,6 @@ void cpu_idle(void)
local_irq_enable();
}
}
- leds_event(led_idle_end);
sched_idle_exit();
preempt_enable_no_resched();
schedule();
--
1.7.7.6
next prev parent reply other threads:[~2012-02-08 1:44 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 1:39 [PATCH RFC 0/4] Scheduler idle notifiers and users Anton Vorontsov
2012-02-08 1:41 ` [PATCH 1/4] sched: Introduce idle notifiers API Anton Vorontsov
2012-02-08 1:43 ` [PATCH 2/4] sched: Wire up idle notifiers Anton Vorontsov
2012-02-08 1:44 ` [PATCH 3/4] cpufreq: New 'interactive' governor Anton Vorontsov
2012-02-08 23:00 ` Vincent Guittot
2012-02-09 0:32 ` Anton Vorontsov
2012-02-08 1:44 ` Anton Vorontsov [this message]
2012-02-08 3:05 ` [PATCH RFC 0/4] Scheduler idle notifiers and users Peter Zijlstra
2012-02-08 20:23 ` Dave Jones
2012-02-08 21:33 ` Benjamin Herrenschmidt
2012-02-09 7:51 ` Ingo Molnar
2012-02-11 3:15 ` Saravana Kannan
2012-02-11 14:39 ` Mark Brown
2012-02-11 14:53 ` Peter Zijlstra
2012-02-11 15:33 ` Mark Brown
2012-02-15 13:38 ` Peter Zijlstra
2012-02-15 16:04 ` Mark Brown
2012-02-12 21:33 ` Benjamin Herrenschmidt
2012-02-11 14:45 ` Ingo Molnar
2012-02-14 23:20 ` Saravana Kannan
2012-02-15 13:38 ` Peter Zijlstra
2012-02-15 14:02 ` Russell King - ARM Linux
2012-02-15 15:01 ` Peter Zijlstra
2012-02-15 16:00 ` Russell King - ARM Linux
2012-02-15 16:09 ` Peter Zijlstra
2012-02-16 3:31 ` Benjamin Herrenschmidt
2012-02-16 10:14 ` Peter Zijlstra
2012-02-17 9:00 ` Dominik Brodowski
2012-02-20 11:03 ` Peter Zijlstra
2012-02-21 12:38 ` Pantelis Antoniou
2012-02-21 12:56 ` Peter Zijlstra
2012-02-21 13:31 ` Pantelis Antoniou
2012-02-21 14:52 ` Amit Kucheria
2012-02-21 17:06 ` Pantelis Antoniou
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=20120208014452.GD459@panacea \
--to=anton.vorontsov@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).