diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-01-15 13:10:39 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-02-07 08:30:21 -0500 |
commit | 71baa1a599c04ab56ebf5fdb8d03abd0d601462f (patch) | |
tree | 7bd66279248bd78c73156bf71982239eca8a8e2f /arch/mips/sgi-ip22/ip22-reset.c | |
parent | 05faa7b758e4f23b66c5a776a338f2348cbbc4af (diff) |
[MIPS] Get rid of unnecessary prototypes. Fixes and optimizations for HZ > 100.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/sgi-ip22/ip22-reset.c')
-rw-r--r-- | arch/mips/sgi-ip22/ip22-reset.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c index 214ffd2e98a3..71b934318d56 100644 --- a/arch/mips/sgi-ip22/ip22-reset.c +++ b/arch/mips/sgi-ip22/ip22-reset.c | |||
@@ -3,8 +3,9 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 1997, 1998, 2001, 2003 by Ralf Baechle | 6 | * Copyright (C) 1997, 1998, 2001, 03, 05 by Ralf Baechle |
7 | */ | 7 | */ |
8 | #include <linux/linkage.h> | ||
8 | #include <linux/init.h> | 9 | #include <linux/init.h> |
9 | #include <linux/ds1286.h> | 10 | #include <linux/ds1286.h> |
10 | #include <linux/module.h> | 11 | #include <linux/module.h> |
@@ -41,28 +42,10 @@ static struct timer_list power_timer, blink_timer, debounce_timer, volume_timer; | |||
41 | 42 | ||
42 | #define MACHINE_PANICED 1 | 43 | #define MACHINE_PANICED 1 |
43 | #define MACHINE_SHUTTING_DOWN 2 | 44 | #define MACHINE_SHUTTING_DOWN 2 |
44 | static int machine_state = 0; | ||
45 | 45 | ||
46 | static void sgi_machine_restart(char *command) __attribute__((noreturn)); | 46 | static int machine_state; |
47 | static void sgi_machine_halt(void) __attribute__((noreturn)); | ||
48 | static void sgi_machine_power_off(void) __attribute__((noreturn)); | ||
49 | 47 | ||
50 | static void sgi_machine_restart(char *command) | 48 | static void ATTRIB_NORET sgi_machine_power_off(void) |
51 | { | ||
52 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
53 | sgi_machine_power_off(); | ||
54 | sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT; | ||
55 | while (1); | ||
56 | } | ||
57 | |||
58 | static void sgi_machine_halt(void) | ||
59 | { | ||
60 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
61 | sgi_machine_power_off(); | ||
62 | ArcEnterInteractiveMode(); | ||
63 | } | ||
64 | |||
65 | static void sgi_machine_power_off(void) | ||
66 | { | 49 | { |
67 | unsigned int tmp; | 50 | unsigned int tmp; |
68 | 51 | ||
@@ -84,6 +67,21 @@ static void sgi_machine_power_off(void) | |||
84 | } | 67 | } |
85 | } | 68 | } |
86 | 69 | ||
70 | static void ATTRIB_NORET sgi_machine_restart(char *command) | ||
71 | { | ||
72 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
73 | sgi_machine_power_off(); | ||
74 | sgimc->cpuctrl0 |= SGIMC_CCTRL0_SYSINIT; | ||
75 | while (1); | ||
76 | } | ||
77 | |||
78 | static void ATTRIB_NORET sgi_machine_halt(void) | ||
79 | { | ||
80 | if (machine_state & MACHINE_SHUTTING_DOWN) | ||
81 | sgi_machine_power_off(); | ||
82 | ArcEnterInteractiveMode(); | ||
83 | } | ||
84 | |||
87 | static void power_timeout(unsigned long data) | 85 | static void power_timeout(unsigned long data) |
88 | { | 86 | { |
89 | sgi_machine_power_off(); | 87 | sgi_machine_power_off(); |
@@ -95,7 +93,7 @@ static void blink_timeout(unsigned long data) | |||
95 | sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); | 93 | sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF); |
96 | sgioc->reset = sgi_ioc_reset; | 94 | sgioc->reset = sgi_ioc_reset; |
97 | 95 | ||
98 | mod_timer(&blink_timer, jiffies+data); | 96 | mod_timer(&blink_timer, jiffies + data); |
99 | } | 97 | } |
100 | 98 | ||
101 | static void debounce(unsigned long data) | 99 | static void debounce(unsigned long data) |
@@ -103,7 +101,7 @@ static void debounce(unsigned long data) | |||
103 | del_timer(&debounce_timer); | 101 | del_timer(&debounce_timer); |
104 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 102 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
105 | /* Interrupt still being sent. */ | 103 | /* Interrupt still being sent. */ |
106 | debounce_timer.expires = jiffies + 5; /* 0.05s */ | 104 | debounce_timer.expires = jiffies + (HZ / 20); /* 0.05s */ |
107 | add_timer(&debounce_timer); | 105 | add_timer(&debounce_timer); |
108 | 106 | ||
109 | sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | | 107 | sgioc->panel = SGIOC_PANEL_POWERON | SGIOC_PANEL_POWERINTR | |
@@ -151,7 +149,7 @@ static inline void volume_up_button(unsigned long data) | |||
151 | indy_volume_button(1); | 149 | indy_volume_button(1); |
152 | 150 | ||
153 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 151 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
154 | volume_timer.expires = jiffies + 1; | 152 | volume_timer.expires = jiffies + (HZ / 100); |
155 | add_timer(&volume_timer); | 153 | add_timer(&volume_timer); |
156 | } | 154 | } |
157 | } | 155 | } |
@@ -164,7 +162,7 @@ static inline void volume_down_button(unsigned long data) | |||
164 | indy_volume_button(-1); | 162 | indy_volume_button(-1); |
165 | 163 | ||
166 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { | 164 | if (sgint->istat1 & SGINT_ISTAT1_PWR) { |
167 | volume_timer.expires = jiffies + 1; | 165 | volume_timer.expires = jiffies + (HZ / 100); |
168 | add_timer(&volume_timer); | 166 | add_timer(&volume_timer); |
169 | } | 167 | } |
170 | } | 168 | } |
@@ -199,14 +197,14 @@ static irqreturn_t panel_int(int irq, void *dev_id, struct pt_regs *regs) | |||
199 | if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { | 197 | if (!(buttons & SGIOC_PANEL_VOLUPINTR)) { |
200 | init_timer(&volume_timer); | 198 | init_timer(&volume_timer); |
201 | volume_timer.function = volume_up_button; | 199 | volume_timer.function = volume_up_button; |
202 | volume_timer.expires = jiffies + 1; | 200 | volume_timer.expires = jiffies + (HZ / 100); |
203 | add_timer(&volume_timer); | 201 | add_timer(&volume_timer); |
204 | } | 202 | } |
205 | /* Volume down button was pressed */ | 203 | /* Volume down button was pressed */ |
206 | if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { | 204 | if (!(buttons & SGIOC_PANEL_VOLDNINTR)) { |
207 | init_timer(&volume_timer); | 205 | init_timer(&volume_timer); |
208 | volume_timer.function = volume_down_button; | 206 | volume_timer.function = volume_down_button; |
209 | volume_timer.expires = jiffies + 1; | 207 | volume_timer.expires = jiffies + (HZ / 100); |
210 | add_timer(&volume_timer); | 208 | add_timer(&volume_timer); |
211 | } | 209 | } |
212 | 210 | ||