提交 0c2cc433 编写于 作者: M Matthias Kaehlcke 提交者: James Bottomley

[SCSI] megaraid_mbox: use mutex instead of semaphore

The Megaraid Mailbox driver uses a semaphore as mutex.  Use the mutex API
instead of the (binary) semaphore.
Signed-off-by: NMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: N"Patro, Sumant" <Sumant.Patro@lsi.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 5fa0f5e4
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
......
...@@ -3880,7 +3880,7 @@ megaraid_sysfs_alloc_resources(adapter_t *adapter) ...@@ -3880,7 +3880,7 @@ megaraid_sysfs_alloc_resources(adapter_t *adapter)
megaraid_sysfs_free_resources(adapter); megaraid_sysfs_free_resources(adapter);
} }
sema_init(&raid_dev->sysfs_sem, 1); mutex_init(&raid_dev->sysfs_mtx);
init_waitqueue_head(&raid_dev->sysfs_wait_q); init_waitqueue_head(&raid_dev->sysfs_wait_q);
...@@ -3981,7 +3981,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter) ...@@ -3981,7 +3981,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
/* /*
* Allow only one read at a time to go through the sysfs attributes * Allow only one read at a time to go through the sysfs attributes
*/ */
down(&raid_dev->sysfs_sem); mutex_lock(&raid_dev->sysfs_mtx);
uioc = raid_dev->sysfs_uioc; uioc = raid_dev->sysfs_uioc;
mbox64 = raid_dev->sysfs_mbox64; mbox64 = raid_dev->sysfs_mbox64;
...@@ -4057,7 +4057,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter) ...@@ -4057,7 +4057,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
del_timer_sync(timerp); del_timer_sync(timerp);
up(&raid_dev->sysfs_sem); mutex_unlock(&raid_dev->sysfs_mtx);
return rval; return rval;
} }
......
...@@ -168,7 +168,7 @@ typedef struct { ...@@ -168,7 +168,7 @@ typedef struct {
* @hw_error : set if FW not responding * @hw_error : set if FW not responding
* @fast_load : If set, skip physical device scanning * @fast_load : If set, skip physical device scanning
* @channel_class : channel class, RAID or SCSI * @channel_class : channel class, RAID or SCSI
* @sysfs_sem : semaphore to serialize access to sysfs res. * @sysfs_mtx : mutex to serialize access to sysfs res.
* @sysfs_uioc : management packet to issue FW calls from sysfs * @sysfs_uioc : management packet to issue FW calls from sysfs
* @sysfs_mbox64 : mailbox packet to issue FW calls from sysfs * @sysfs_mbox64 : mailbox packet to issue FW calls from sysfs
* @sysfs_buffer : data buffer for FW commands issued from sysfs * @sysfs_buffer : data buffer for FW commands issued from sysfs
...@@ -208,7 +208,7 @@ typedef struct { ...@@ -208,7 +208,7 @@ typedef struct {
int hw_error; int hw_error;
int fast_load; int fast_load;
uint8_t channel_class; uint8_t channel_class;
struct semaphore sysfs_sem; struct mutex sysfs_mtx;
uioc_t *sysfs_uioc; uioc_t *sysfs_uioc;
mbox64_t *sysfs_mbox64; mbox64_t *sysfs_mbox64;
caddr_t sysfs_buffer; caddr_t sysfs_buffer;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册