aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Minyard <minyard@acm.org>2005-06-24 01:01:44 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:23 -0400
commit77cf3973f22c7e7158f5e2c3c3d6809125b77e4b (patch)
tree8c24abece4c6b3fb8d421e5ff94e21cc9a07f656
parent3b6259432dee81f928c22c48c080d5f6325ed92e (diff)
[PATCH] ipmi: use completions, not semaphores, in powerdown code
Don't use semaphores for IPC in the poweroff code, use completions instead. 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_poweroff.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c
index 61329b55c4a9..f951c30236c9 100644
--- a/drivers/char/ipmi/ipmi_poweroff.c
+++ b/drivers/char/ipmi/ipmi_poweroff.c
@@ -31,12 +31,13 @@
31 * with this program; if not, write to the Free Software Foundation, Inc., 31 * with this program; if not, write to the Free Software Foundation, Inc.,
32 * 675 Mass Ave, Cambridge, MA 02139, USA. 32 * 675 Mass Ave, Cambridge, MA 02139, USA.
33 */ 33 */
34#include <asm/semaphore.h> 34#include <linux/config.h>
35#include <linux/kdev_t.h>
36#include <linux/module.h> 35#include <linux/module.h>
37#include <linux/moduleparam.h> 36#include <linux/moduleparam.h>
38#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
39#include <linux/string.h> 38#include <linux/string.h>
39#include <linux/completion.h>
40#include <linux/kdev_t.h>
40#include <linux/ipmi.h> 41#include <linux/ipmi.h>
41#include <linux/ipmi_smi.h> 42#include <linux/ipmi_smi.h>
42 43
@@ -89,10 +90,10 @@ static struct ipmi_recv_msg halt_recv_msg =
89 90
90static void receive_handler(struct ipmi_recv_msg *recv_msg, void *handler_data) 91static void receive_handler(struct ipmi_recv_msg *recv_msg, void *handler_data)
91{ 92{
92 struct semaphore *sem = recv_msg->user_msg_data; 93 struct completion *comp = recv_msg->user_msg_data;
93 94
94 if (sem) 95 if (comp)
95 up(sem); 96 complete(comp);
96} 97}
97 98
98static struct ipmi_user_hndl ipmi_poweroff_handler = 99static struct ipmi_user_hndl ipmi_poweroff_handler =
@@ -105,27 +106,27 @@ static int ipmi_request_wait_for_response(ipmi_user_t user,
105 struct ipmi_addr *addr, 106 struct ipmi_addr *addr,
106 struct kernel_ipmi_msg *send_msg) 107 struct kernel_ipmi_msg *send_msg)
107{ 108{
108 int rv; 109 int rv;
109 struct semaphore sem; 110 struct completion comp;
110 111
111 sema_init (&sem, 0); 112 init_completion(&comp);
112 113
113 rv = ipmi_request_supply_msgs(user, addr, 0, send_msg, &sem, 114 rv = ipmi_request_supply_msgs(user, addr, 0, send_msg, &comp,
114 &halt_smi_msg, &halt_recv_msg, 0); 115 &halt_smi_msg, &halt_recv_msg, 0);
115 if (rv) 116 if (rv)
116 return rv; 117 return rv;
117 118
118 down (&sem); 119 wait_for_completion(&comp);
119 120
120 return halt_recv_msg.msg.data[0]; 121 return halt_recv_msg.msg.data[0];
121} 122}
122 123
123/* We are in run-to-completion mode, no semaphore is desired. */ 124/* We are in run-to-completion mode, no completion is desired. */
124static int ipmi_request_in_rc_mode(ipmi_user_t user, 125static int ipmi_request_in_rc_mode(ipmi_user_t user,
125 struct ipmi_addr *addr, 126 struct ipmi_addr *addr,
126 struct kernel_ipmi_msg *send_msg) 127 struct kernel_ipmi_msg *send_msg)
127{ 128{
128 int rv; 129 int rv;
129 130
130 rv = ipmi_request_supply_msgs(user, addr, 0, send_msg, NULL, 131 rv = ipmi_request_supply_msgs(user, addr, 0, send_msg, NULL,
131 &halt_smi_msg, &halt_recv_msg, 0); 132 &halt_smi_msg, &halt_recv_msg, 0);