[SCSI] turn most scsi semaphores into mutexes
the scsi layer is using semaphores in a mutex way, this patch converts these into using mutexes instead Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
committed by
James Bottomley
parent
dacee84b07
commit
0b95067238
@@ -61,6 +61,7 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
|
||||
#include <linux/timer.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#include <asm/processor.h> /* for boot_cpu_data */
|
||||
#include <asm/pgtable.h>
|
||||
@@ -106,7 +107,7 @@ static dpt_sig_S DPTI_sig = {
|
||||
*============================================================================
|
||||
*/
|
||||
|
||||
static DECLARE_MUTEX(adpt_configuration_lock);
|
||||
static DEFINE_MUTEX(adpt_configuration_lock);
|
||||
|
||||
static struct i2o_sys_tbl *sys_tbl = NULL;
|
||||
static int sys_tbl_ind = 0;
|
||||
@@ -537,13 +538,13 @@ static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, of
|
||||
*/
|
||||
|
||||
// Find HBA (host bus adapter) we are looking for
|
||||
down(&adpt_configuration_lock);
|
||||
mutex_lock(&adpt_configuration_lock);
|
||||
for (pHba = hba_chain; pHba; pHba = pHba->next) {
|
||||
if (pHba->host == host) {
|
||||
break; /* found adapter */
|
||||
}
|
||||
}
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
if (pHba == NULL) {
|
||||
return 0;
|
||||
}
|
||||
@@ -958,7 +959,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
|
||||
}
|
||||
memset(pHba, 0, sizeof(adpt_hba));
|
||||
|
||||
down(&adpt_configuration_lock);
|
||||
mutex_lock(&adpt_configuration_lock);
|
||||
|
||||
if(hba_chain != NULL){
|
||||
for(p = hba_chain; p->next; p = p->next);
|
||||
@@ -971,7 +972,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
|
||||
sprintf(pHba->name, "dpti%d", hba_count);
|
||||
hba_count++;
|
||||
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
|
||||
pHba->pDev = pDev;
|
||||
pHba->base_addr_phys = base_addr0_phys;
|
||||
@@ -1027,7 +1028,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
|
||||
struct adpt_device* pNext;
|
||||
|
||||
|
||||
down(&adpt_configuration_lock);
|
||||
mutex_lock(&adpt_configuration_lock);
|
||||
// scsi_unregister calls our adpt_release which
|
||||
// does a quiese
|
||||
if(pHba->host){
|
||||
@@ -1046,7 +1047,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
|
||||
}
|
||||
|
||||
hba_count--;
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
|
||||
iounmap(pHba->base_addr_virt);
|
||||
pci_release_regions(pHba->pDev);
|
||||
@@ -1549,7 +1550,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba)
|
||||
|
||||
static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d)
|
||||
{
|
||||
down(&adpt_configuration_lock);
|
||||
mutex_lock(&adpt_configuration_lock);
|
||||
d->controller=pHba;
|
||||
d->owner=NULL;
|
||||
d->next=pHba->devices;
|
||||
@@ -1560,7 +1561,7 @@ static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d)
|
||||
pHba->devices=d;
|
||||
*d->dev_name = 0;
|
||||
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1575,24 +1576,24 @@ static int adpt_open(struct inode *inode, struct file *file)
|
||||
if (minor >= hba_count) {
|
||||
return -ENXIO;
|
||||
}
|
||||
down(&adpt_configuration_lock);
|
||||
mutex_lock(&adpt_configuration_lock);
|
||||
for (pHba = hba_chain; pHba; pHba = pHba->next) {
|
||||
if (pHba->unit == minor) {
|
||||
break; /* found adapter */
|
||||
}
|
||||
}
|
||||
if (pHba == NULL) {
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
// if(pHba->in_use){
|
||||
// up(&adpt_configuration_lock);
|
||||
// mutex_unlock(&adpt_configuration_lock);
|
||||
// return -EBUSY;
|
||||
// }
|
||||
|
||||
pHba->in_use = 1;
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1606,13 +1607,13 @@ static int adpt_close(struct inode *inode, struct file *file)
|
||||
if (minor >= hba_count) {
|
||||
return -ENXIO;
|
||||
}
|
||||
down(&adpt_configuration_lock);
|
||||
mutex_lock(&adpt_configuration_lock);
|
||||
for (pHba = hba_chain; pHba; pHba = pHba->next) {
|
||||
if (pHba->unit == minor) {
|
||||
break; /* found adapter */
|
||||
}
|
||||
}
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
if (pHba == NULL) {
|
||||
return -ENXIO;
|
||||
}
|
||||
@@ -1910,13 +1911,13 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
|
||||
if (minor >= DPTI_MAX_HBA){
|
||||
return -ENXIO;
|
||||
}
|
||||
down(&adpt_configuration_lock);
|
||||
mutex_lock(&adpt_configuration_lock);
|
||||
for (pHba = hba_chain; pHba; pHba = pHba->next) {
|
||||
if (pHba->unit == minor) {
|
||||
break; /* found adapter */
|
||||
}
|
||||
}
|
||||
up(&adpt_configuration_lock);
|
||||
mutex_unlock(&adpt_configuration_lock);
|
||||
if(pHba == NULL){
|
||||
return -ENXIO;
|
||||
}
|
||||
|
Reference in New Issue
Block a user