diff options
-rw-r--r-- | arch/sh/kernel/process.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 6b4f5748d0be..a11e2aa73cbc 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
@@ -26,8 +26,6 @@ | |||
26 | static int hlt_counter; | 26 | static int hlt_counter; |
27 | int ubc_usercnt = 0; | 27 | int ubc_usercnt = 0; |
28 | 28 | ||
29 | #define HARD_IDLE_TIMEOUT (HZ / 3) | ||
30 | |||
31 | void (*pm_idle)(void); | 29 | void (*pm_idle)(void); |
32 | void (*pm_power_off)(void); | 30 | void (*pm_power_off)(void); |
33 | EXPORT_SYMBOL(pm_power_off); | 31 | EXPORT_SYMBOL(pm_power_off); |
@@ -44,16 +42,39 @@ void enable_hlt(void) | |||
44 | } | 42 | } |
45 | EXPORT_SYMBOL(enable_hlt); | 43 | EXPORT_SYMBOL(enable_hlt); |
46 | 44 | ||
45 | static int __init nohlt_setup(char *__unused) | ||
46 | { | ||
47 | hlt_counter = 1; | ||
48 | return 1; | ||
49 | } | ||
50 | __setup("nohlt", nohlt_setup); | ||
51 | |||
52 | static int __init hlt_setup(char *__unused) | ||
53 | { | ||
54 | hlt_counter = 0; | ||
55 | return 1; | ||
56 | } | ||
57 | __setup("hlt", hlt_setup); | ||
58 | |||
47 | void default_idle(void) | 59 | void default_idle(void) |
48 | { | 60 | { |
49 | if (!hlt_counter) | 61 | if (!hlt_counter) { |
50 | cpu_sleep(); | 62 | clear_thread_flag(TIF_POLLING_NRFLAG); |
51 | else | 63 | smp_mb__after_clear_bit(); |
52 | cpu_relax(); | 64 | set_bl_bit(); |
65 | while (!need_resched()) | ||
66 | cpu_sleep(); | ||
67 | clear_bl_bit(); | ||
68 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
69 | } else | ||
70 | while (!need_resched()) | ||
71 | cpu_relax(); | ||
53 | } | 72 | } |
54 | 73 | ||
55 | void cpu_idle(void) | 74 | void cpu_idle(void) |
56 | { | 75 | { |
76 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
77 | |||
57 | /* endless idle loop with no priority at all */ | 78 | /* endless idle loop with no priority at all */ |
58 | while (1) { | 79 | while (1) { |
59 | void (*idle)(void) = pm_idle; | 80 | void (*idle)(void) = pm_idle; |