aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi/ipmi_devintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/ipmi/ipmi_devintf.c')
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 932feedda262..e1c95374984c 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -42,7 +42,7 @@
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <linux/devfs_fs_kernel.h> 43#include <linux/devfs_fs_kernel.h>
44#include <linux/ipmi.h> 44#include <linux/ipmi.h>
45#include <asm/semaphore.h> 45#include <linux/mutex.h>
46#include <linux/init.h> 46#include <linux/init.h>
47#include <linux/device.h> 47#include <linux/device.h>
48#include <linux/compat.h> 48#include <linux/compat.h>
@@ -55,7 +55,7 @@ struct ipmi_file_private
55 struct file *file; 55 struct file *file;
56 struct fasync_struct *fasync_queue; 56 struct fasync_struct *fasync_queue;
57 wait_queue_head_t wait; 57 wait_queue_head_t wait;
58 struct semaphore recv_sem; 58 struct mutex recv_mutex;
59 int default_retries; 59 int default_retries;
60 unsigned int default_retry_time_ms; 60 unsigned int default_retry_time_ms;
61}; 61};
@@ -141,7 +141,7 @@ static int ipmi_open(struct inode *inode, struct file *file)
141 INIT_LIST_HEAD(&(priv->recv_msgs)); 141 INIT_LIST_HEAD(&(priv->recv_msgs));
142 init_waitqueue_head(&priv->wait); 142 init_waitqueue_head(&priv->wait);
143 priv->fasync_queue = NULL; 143 priv->fasync_queue = NULL;
144 sema_init(&(priv->recv_sem), 1); 144 mutex_init(&priv->recv_mutex);
145 145
146 /* Use the low-level defaults. */ 146 /* Use the low-level defaults. */
147 priv->default_retries = -1; 147 priv->default_retries = -1;
@@ -285,15 +285,15 @@ static int ipmi_ioctl(struct inode *inode,
285 break; 285 break;
286 } 286 }
287 287
288 /* We claim a semaphore because we don't want two 288 /* We claim a mutex because we don't want two
289 users getting something from the queue at a time. 289 users getting something from the queue at a time.
290 Since we have to release the spinlock before we can 290 Since we have to release the spinlock before we can
291 copy the data to the user, it's possible another 291 copy the data to the user, it's possible another
292 user will grab something from the queue, too. Then 292 user will grab something from the queue, too. Then
293 the messages might get out of order if something 293 the messages might get out of order if something
294 fails and the message gets put back onto the 294 fails and the message gets put back onto the
295 queue. This semaphore prevents that problem. */ 295 queue. This mutex prevents that problem. */
296 down(&(priv->recv_sem)); 296 mutex_lock(&priv->recv_mutex);
297 297
298 /* Grab the message off the list. */ 298 /* Grab the message off the list. */
299 spin_lock_irqsave(&(priv->recv_msg_lock), flags); 299 spin_lock_irqsave(&(priv->recv_msg_lock), flags);
@@ -352,7 +352,7 @@ static int ipmi_ioctl(struct inode *inode,
352 goto recv_putback_on_err; 352 goto recv_putback_on_err;
353 } 353 }
354 354
355 up(&(priv->recv_sem)); 355 mutex_unlock(&priv->recv_mutex);
356 ipmi_free_recv_msg(msg); 356 ipmi_free_recv_msg(msg);
357 break; 357 break;
358 358
@@ -362,11 +362,11 @@ static int ipmi_ioctl(struct inode *inode,
362 spin_lock_irqsave(&(priv->recv_msg_lock), flags); 362 spin_lock_irqsave(&(priv->recv_msg_lock), flags);
363 list_add(entry, &(priv->recv_msgs)); 363 list_add(entry, &(priv->recv_msgs));
364 spin_unlock_irqrestore(&(priv->recv_msg_lock), flags); 364 spin_unlock_irqrestore(&(priv->recv_msg_lock), flags);
365 up(&(priv->recv_sem)); 365 mutex_unlock(&priv->recv_mutex);
366 break; 366 break;
367 367
368 recv_err: 368 recv_err:
369 up(&(priv->recv_sem)); 369 mutex_unlock(&priv->recv_mutex);
370 break; 370 break;
371 } 371 }
372 372