aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Minyard <minyard@acm.org>2005-06-24 01:01:40 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:23 -0400
commit8f43f84f13a49fe5f0f7d1595082b6d7ec6daa85 (patch)
tree90ae2d056b5e0ad46a4ef88b8c7d76ff514bf5c4
parent845e78a15726f238fe1398b8c07754726cd726a7 (diff)
[PATCH] ipmi: timer shutdown cleanup
Clean up the timer shutdown handling in the IPMI driver. Signed-off-by: Corey Minyard <minyard@acm.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 0c81652eaba6..ed75e96d0035 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2747,16 +2747,13 @@ static struct timer_list ipmi_timer;
2747 the queue and this silliness can go away. */ 2747 the queue and this silliness can go away. */
2748#define IPMI_REQUEST_EV_TIME (1000 / (IPMI_TIMEOUT_TIME)) 2748#define IPMI_REQUEST_EV_TIME (1000 / (IPMI_TIMEOUT_TIME))
2749 2749
2750static volatile int stop_operation = 0; 2750static atomic_t stop_operation;
2751static volatile int timer_stopped = 0;
2752static unsigned int ticks_to_req_ev = IPMI_REQUEST_EV_TIME; 2751static unsigned int ticks_to_req_ev = IPMI_REQUEST_EV_TIME;
2753 2752
2754static void ipmi_timeout(unsigned long data) 2753static void ipmi_timeout(unsigned long data)
2755{ 2754{
2756 if (stop_operation) { 2755 if (atomic_read(&stop_operation))
2757 timer_stopped = 1;
2758 return; 2756 return;
2759 }
2760 2757
2761 ticks_to_req_ev--; 2758 ticks_to_req_ev--;
2762 if (ticks_to_req_ev == 0) { 2759 if (ticks_to_req_ev == 0) {
@@ -2766,8 +2763,7 @@ static void ipmi_timeout(unsigned long data)
2766 2763
2767 ipmi_timeout_handler(IPMI_TIMEOUT_TIME); 2764 ipmi_timeout_handler(IPMI_TIMEOUT_TIME);
2768 2765
2769 ipmi_timer.expires += IPMI_TIMEOUT_JIFFIES; 2766 mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
2770 add_timer(&ipmi_timer);
2771} 2767}
2772 2768
2773 2769
@@ -3130,11 +3126,8 @@ static __exit void cleanup_ipmi(void)
3130 3126
3131 /* Tell the timer to stop, then wait for it to stop. This avoids 3127 /* Tell the timer to stop, then wait for it to stop. This avoids
3132 problems with race conditions removing the timer here. */ 3128 problems with race conditions removing the timer here. */
3133 stop_operation = 1; 3129 atomic_inc(&stop_operation);
3134 while (!timer_stopped) { 3130 del_timer_sync(&ipmi_timer);
3135 set_current_state(TASK_UNINTERRUPTIBLE);
3136 schedule_timeout(1);
3137 }
3138 3131
3139 remove_proc_entry(proc_ipmi_root->name, &proc_root); 3132 remove_proc_entry(proc_ipmi_root->name, &proc_root);
3140 3133