mips: ip22/32: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Adds a static variable to hold timeout value. Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: James Hogan <james.hogan@imgtec.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux-mips@linux-mips.org Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
parent
96d130824f
commit
a66b899dfb
@ -38,6 +38,7 @@
|
||||
#define PANIC_FREQ (HZ / 8)
|
||||
|
||||
static struct timer_list power_timer, blink_timer, debounce_timer;
|
||||
static unsigned long blink_timer_timeout;
|
||||
|
||||
#define MACHINE_PANICED 1
|
||||
#define MACHINE_SHUTTING_DOWN 2
|
||||
@ -81,21 +82,21 @@ static void __noreturn sgi_machine_halt(void)
|
||||
ArcEnterInteractiveMode();
|
||||
}
|
||||
|
||||
static void power_timeout(unsigned long data)
|
||||
static void power_timeout(struct timer_list *unused)
|
||||
{
|
||||
sgi_machine_power_off();
|
||||
}
|
||||
|
||||
static void blink_timeout(unsigned long data)
|
||||
static void blink_timeout(struct timer_list *unused)
|
||||
{
|
||||
/* XXX fix this for fullhouse */
|
||||
sgi_ioc_reset ^= (SGIOC_RESET_LC0OFF|SGIOC_RESET_LC1OFF);
|
||||
sgioc->reset = sgi_ioc_reset;
|
||||
|
||||
mod_timer(&blink_timer, jiffies + data);
|
||||
mod_timer(&blink_timer, jiffies + blink_timer_timeout);
|
||||
}
|
||||
|
||||
static void debounce(unsigned long data)
|
||||
static void debounce(struct timer_list *unused)
|
||||
{
|
||||
del_timer(&debounce_timer);
|
||||
if (sgint->istat1 & SGINT_ISTAT1_PWR) {
|
||||
@ -128,11 +129,10 @@ static inline void power_button(void)
|
||||
}
|
||||
|
||||
machine_state |= MACHINE_SHUTTING_DOWN;
|
||||
blink_timer.data = POWERDOWN_FREQ;
|
||||
blink_timeout(POWERDOWN_FREQ);
|
||||
blink_timer_timeout = POWERDOWN_FREQ;
|
||||
blink_timeout(&blink_timer);
|
||||
|
||||
init_timer(&power_timer);
|
||||
power_timer.function = power_timeout;
|
||||
timer_setup(&power_timer, power_timeout, 0);
|
||||
power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
|
||||
add_timer(&power_timer);
|
||||
}
|
||||
@ -147,8 +147,7 @@ static irqreturn_t panel_int(int irq, void *dev_id)
|
||||
if (sgint->istat1 & SGINT_ISTAT1_PWR) {
|
||||
/* Wait until interrupt goes away */
|
||||
disable_irq_nosync(SGI_PANEL_IRQ);
|
||||
init_timer(&debounce_timer);
|
||||
debounce_timer.function = debounce;
|
||||
timer_setup(&debounce_timer, debounce, 0);
|
||||
debounce_timer.expires = jiffies + 5;
|
||||
add_timer(&debounce_timer);
|
||||
}
|
||||
@ -171,8 +170,8 @@ static int panic_event(struct notifier_block *this, unsigned long event,
|
||||
return NOTIFY_DONE;
|
||||
machine_state |= MACHINE_PANICED;
|
||||
|
||||
blink_timer.data = PANIC_FREQ;
|
||||
blink_timeout(PANIC_FREQ);
|
||||
blink_timer_timeout = PANIC_FREQ;
|
||||
blink_timeout(&blink_timer);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
@ -195,8 +194,7 @@ static int __init reboot_setup(void)
|
||||
return res;
|
||||
}
|
||||
|
||||
init_timer(&blink_timer);
|
||||
blink_timer.function = blink_timeout;
|
||||
timer_setup(&blink_timer, blink_timeout, 0);
|
||||
atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
|
||||
|
||||
return 0;
|
||||
|
@ -38,6 +38,7 @@
|
||||
extern struct platform_device ip32_rtc_device;
|
||||
|
||||
static struct timer_list power_timer, blink_timer;
|
||||
static unsigned long blink_timer_timeout;
|
||||
static int has_panicked, shutting_down;
|
||||
|
||||
static __noreturn void ip32_poweroff(void *data)
|
||||
@ -71,11 +72,11 @@ static void ip32_machine_restart(char *cmd)
|
||||
unreachable();
|
||||
}
|
||||
|
||||
static void blink_timeout(unsigned long data)
|
||||
static void blink_timeout(struct timer_list *unused)
|
||||
{
|
||||
unsigned long led = mace->perif.ctrl.misc ^ MACEISA_LED_RED;
|
||||
mace->perif.ctrl.misc = led;
|
||||
mod_timer(&blink_timer, jiffies + data);
|
||||
mod_timer(&blink_timer, jiffies + blink_timer_timeout);
|
||||
}
|
||||
|
||||
static void ip32_machine_halt(void)
|
||||
@ -83,7 +84,7 @@ static void ip32_machine_halt(void)
|
||||
ip32_poweroff(&ip32_rtc_device);
|
||||
}
|
||||
|
||||
static void power_timeout(unsigned long data)
|
||||
static void power_timeout(struct timer_list *unused)
|
||||
{
|
||||
ip32_poweroff(&ip32_rtc_device);
|
||||
}
|
||||
@ -99,11 +100,10 @@ void ip32_prepare_poweroff(void)
|
||||
}
|
||||
|
||||
shutting_down = 1;
|
||||
blink_timer.data = POWERDOWN_FREQ;
|
||||
blink_timeout(POWERDOWN_FREQ);
|
||||
blink_timer_timeout = POWERDOWN_FREQ;
|
||||
blink_timeout(&blink_timer);
|
||||
|
||||
init_timer(&power_timer);
|
||||
power_timer.function = power_timeout;
|
||||
timer_setup(&power_timer, power_timeout, 0);
|
||||
power_timer.expires = jiffies + POWERDOWN_TIMEOUT * HZ;
|
||||
add_timer(&power_timer);
|
||||
}
|
||||
@ -121,8 +121,8 @@ static int panic_event(struct notifier_block *this, unsigned long event,
|
||||
led = mace->perif.ctrl.misc | MACEISA_LED_GREEN;
|
||||
mace->perif.ctrl.misc = led;
|
||||
|
||||
blink_timer.data = PANIC_FREQ;
|
||||
blink_timeout(PANIC_FREQ);
|
||||
blink_timer_timeout = PANIC_FREQ;
|
||||
blink_timeout(&blink_timer);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
@ -143,8 +143,7 @@ static __init int ip32_reboot_setup(void)
|
||||
_machine_halt = ip32_machine_halt;
|
||||
pm_power_off = ip32_machine_halt;
|
||||
|
||||
init_timer(&blink_timer);
|
||||
blink_timer.function = blink_timeout;
|
||||
timer_setup(&blink_timer, blink_timeout, 0);
|
||||
atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user