Skip to content

Commit

Permalink
ARM: Move leds idle start/stop calls to idle notifiers
Browse files Browse the repository at this point in the history
Change-Id: I5d8e4e85b17bbab7992ecb477f0bdb5e4138b166
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
  • Loading branch information
colincross authored and myfluxi committed Jan 17, 2012
1 parent 0809d70 commit 451567a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
24 changes: 24 additions & 0 deletions arch/arm/kernel/leds.c
Expand Up @@ -9,6 +9,8 @@
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
#include <linux/sysdev.h>

#include <asm/leds.h>
Expand Down Expand Up @@ -99,6 +101,25 @@ static struct sys_device leds_device = {
.cls = &leds_sysclass,
};

static int leds_idle_notifier(struct notifier_block *nb, unsigned long val,
void *data)
{
switch (val) {
case IDLE_START:
leds_event(led_idle_start);
break;
case 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;
Expand All @@ -107,6 +128,9 @@ static int __init leds_init(void)
ret = sysdev_register(&leds_device);
if (ret == 0)
ret = sysdev_create_file(&leds_device, &attr_event);
if (ret == 0)
idle_notifier_register(&leds_idle_nb);

return ret;
}

Expand Down
3 changes: 0 additions & 3 deletions arch/arm/kernel/process.c
Expand Up @@ -29,7 +29,6 @@
#include <linux/utsname.h>
#include <linux/uaccess.h>

#include <asm/leds.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/thread_notify.h>
Expand Down Expand Up @@ -147,7 +146,6 @@ void cpu_idle(void)
/* endless idle loop with no priority at all */
while (1) {
tick_nohz_stop_sched_tick(1);
leds_event(led_idle_start);
idle_notifier_call_chain(IDLE_START);
while (!need_resched()) {
#ifdef CONFIG_HOTPLUG_CPU
Expand All @@ -172,7 +170,6 @@ void cpu_idle(void)
local_irq_enable();
}
}
leds_event(led_idle_end);
idle_notifier_call_chain(IDLE_END);
tick_nohz_restart_sched_tick();
preempt_enable_no_resched();
Expand Down

0 comments on commit 451567a

Please sign in to comment.