From: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
To: megaraidlinux@lsi.com, linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: [PATCH 1/5] use mutex instead of semaphore in Megaraid Mailbox driver
Date: Sun, 1 Jul 2007 18:29:21 +0200 [thread overview]
Message-ID: <20070701162921.GD3940@traven> (raw)
In-Reply-To: <20070701162529.GC3940@traven>
The Megaraid Mailbox driver uses a semaphore as mutex. Use the mutex
API instead of the (binary) semaphore.
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 26e1e6c..fef9ac9 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -21,6 +21,7 @@
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/blkdev.h>
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 04d0b69..2cecc64 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -3957,7 +3957,7 @@ megaraid_sysfs_alloc_resources(adapter_t *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);
@@ -4058,7 +4058,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
/*
* 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;
mbox64 = raid_dev->sysfs_mbox64;
@@ -4134,7 +4134,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter)
del_timer_sync(timerp);
- up(&raid_dev->sysfs_sem);
+ mutex_unlock(&raid_dev->sysfs_mtx);
return rval;
}
diff --git a/drivers/scsi/megaraid/megaraid_mbox.h b/drivers/scsi/megaraid/megaraid_mbox.h
index 9de803c..626459d 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.h
+++ b/drivers/scsi/megaraid/megaraid_mbox.h
@@ -168,7 +168,7 @@ typedef struct {
* @hw_error : set if FW not responding
* @fast_load : If set, skip physical device scanning
* @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_mbox64 : mailbox packet to issue FW calls from sysfs
* @sysfs_buffer : data buffer for FW commands issued from sysfs
@@ -208,7 +208,7 @@ typedef struct {
int hw_error;
int fast_load;
uint8_t channel_class;
- struct semaphore sysfs_sem;
+ struct mutex sysfs_mtx;
uioc_t *sysfs_uioc;
mbox64_t *sysfs_mbox64;
caddr_t sysfs_buffer;
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
An ounce of practice is worth more than tons of preaching
(Mahatma Gandhi)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
next prev parent reply other threads:[~2007-07-01 16:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-01 16:25 [PATCH 0/5] use mutex instead of semaphore in several drivers Matthias Kaehlcke
2007-07-01 16:29 ` Matthias Kaehlcke [this message]
2007-07-03 18:09 ` [PATCH 1/5] use mutex instead of semaphore in Megaraid Mailbox driver Patro, Sumant
2007-07-03 18:09 ` Patro, Sumant
2007-07-01 16:30 ` [PATCH 2/5] use mutex instead of semaphore in Philips webcam driver Matthias Kaehlcke
2007-07-01 16:32 ` [lm-sensors] [PATCH 3/5] use mutex instead of semaphore in SMSC Matthias Kaehlcke
2007-07-01 16:32 ` [PATCH 3/5] use mutex instead of semaphore in SMSC LPC47M192 driver Matthias Kaehlcke
2007-07-01 17:26 ` [lm-sensors] [PATCH 3/5] use mutex instead of semaphore in SMSC Mark M. Hoffman
2007-07-01 17:26 ` [lm-sensors] [PATCH 3/5] use mutex instead of semaphore in SMSC LPC47M192 driver Mark M. Hoffman
2007-07-01 16:33 ` [PATCH 4/5] use mutex instead of semaphore in Virtual Video driver Matthias Kaehlcke
2007-07-01 16:35 ` [PATCH 5/5] use mutex instead of semaphore in VLSI 82C147 IrDA controller driver Matthias Kaehlcke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070701162921.GD3940@traven \
--to=matthias.kaehlcke@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=megaraidlinux@lsi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.