sysfs: Complain bitterly about attempts to remove files from nonexistent directories.
[zen-stable.git] / arch / openrisc / kernel / idle.c
blobe5fc788778306965c13615f90a0bccff84626402
1 /*
2 * OpenRISC idle.c
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
8 * Modifications for the OpenRISC architecture:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
17 * Idle daemon for or32. Idle daemon will handle any action
18 * that needs to be taken when the system becomes idle.
21 #include <linux/errno.h>
22 #include <linux/sched.h>
23 #include <linux/kernel.h>
24 #include <linux/mm.h>
25 #include <linux/smp.h>
26 #include <linux/stddef.h>
27 #include <linux/unistd.h>
28 #include <linux/ptrace.h>
29 #include <linux/slab.h>
30 #include <linux/tick.h>
32 #include <asm/pgtable.h>
33 #include <asm/uaccess.h>
34 #include <asm/system.h>
35 #include <asm/io.h>
36 #include <asm/processor.h>
37 #include <asm/mmu.h>
38 #include <asm/cache.h>
39 #include <asm/pgalloc.h>
41 void (*powersave) (void) = NULL;
43 static inline void pm_idle(void)
45 barrier();
48 void cpu_idle(void)
50 set_thread_flag(TIF_POLLING_NRFLAG);
52 /* endless idle loop with no priority at all */
53 while (1) {
54 tick_nohz_idle_enter();
55 rcu_idle_enter();
57 while (!need_resched()) {
58 check_pgt_cache();
59 rmb();
61 clear_thread_flag(TIF_POLLING_NRFLAG);
63 local_irq_disable();
64 /* Don't trace irqs off for idle */
65 stop_critical_timings();
66 if (!need_resched() && powersave != NULL)
67 powersave();
68 start_critical_timings();
69 local_irq_enable();
70 set_thread_flag(TIF_POLLING_NRFLAG);
73 rcu_idle_exit();
74 tick_nohz_idle_exit();
75 preempt_enable_no_resched();
76 schedule();
77 preempt_disable();