Commit 8f43f84f authored by Corey Minyard's avatar Corey Minyard Committed by Linus Torvalds

[PATCH] ipmi: timer shutdown cleanup

Clean up the timer shutdown handling in the IPMI driver.
Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 845e78a1
...@@ -2747,16 +2747,13 @@ static struct timer_list ipmi_timer; ...@@ -2747,16 +2747,13 @@ static struct timer_list ipmi_timer;
the queue and this silliness can go away. */ the queue and this silliness can go away. */
#define IPMI_REQUEST_EV_TIME (1000 / (IPMI_TIMEOUT_TIME)) #define IPMI_REQUEST_EV_TIME (1000 / (IPMI_TIMEOUT_TIME))
static volatile int stop_operation = 0; static atomic_t stop_operation;
static volatile int timer_stopped = 0;
static unsigned int ticks_to_req_ev = IPMI_REQUEST_EV_TIME; static unsigned int ticks_to_req_ev = IPMI_REQUEST_EV_TIME;
static void ipmi_timeout(unsigned long data) static void ipmi_timeout(unsigned long data)
{ {
if (stop_operation) { if (atomic_read(&stop_operation))
timer_stopped = 1;
return; return;
}
ticks_to_req_ev--; ticks_to_req_ev--;
if (ticks_to_req_ev == 0) { if (ticks_to_req_ev == 0) {
...@@ -2766,8 +2763,7 @@ static void ipmi_timeout(unsigned long data) ...@@ -2766,8 +2763,7 @@ static void ipmi_timeout(unsigned long data)
ipmi_timeout_handler(IPMI_TIMEOUT_TIME); ipmi_timeout_handler(IPMI_TIMEOUT_TIME);
ipmi_timer.expires += IPMI_TIMEOUT_JIFFIES; mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
add_timer(&ipmi_timer);
} }
...@@ -3130,11 +3126,8 @@ static __exit void cleanup_ipmi(void) ...@@ -3130,11 +3126,8 @@ static __exit void cleanup_ipmi(void)
/* Tell the timer to stop, then wait for it to stop. This avoids /* Tell the timer to stop, then wait for it to stop. This avoids
problems with race conditions removing the timer here. */ problems with race conditions removing the timer here. */
stop_operation = 1; atomic_inc(&stop_operation);
while (!timer_stopped) { del_timer_sync(&ipmi_timer);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
}
remove_proc_entry(proc_ipmi_root->name, &proc_root); remove_proc_entry(proc_ipmi_root->name, &proc_root);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment