diff options
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 6252b9ddc01e..cdeb30b0462e 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -61,6 +61,7 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver"); | |||
61 | #include <linux/timer.h> | 61 | #include <linux/timer.h> |
62 | #include <linux/string.h> | 62 | #include <linux/string.h> |
63 | #include <linux/ioport.h> | 63 | #include <linux/ioport.h> |
64 | #include <linux/mutex.h> | ||
64 | 65 | ||
65 | #include <asm/processor.h> /* for boot_cpu_data */ | 66 | #include <asm/processor.h> /* for boot_cpu_data */ |
66 | #include <asm/pgtable.h> | 67 | #include <asm/pgtable.h> |
@@ -106,7 +107,7 @@ static dpt_sig_S DPTI_sig = { | |||
106 | *============================================================================ | 107 | *============================================================================ |
107 | */ | 108 | */ |
108 | 109 | ||
109 | static DECLARE_MUTEX(adpt_configuration_lock); | 110 | static DEFINE_MUTEX(adpt_configuration_lock); |
110 | 111 | ||
111 | static struct i2o_sys_tbl *sys_tbl = NULL; | 112 | static struct i2o_sys_tbl *sys_tbl = NULL; |
112 | static int sys_tbl_ind = 0; | 113 | static int sys_tbl_ind = 0; |
@@ -537,13 +538,13 @@ static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, of | |||
537 | */ | 538 | */ |
538 | 539 | ||
539 | // Find HBA (host bus adapter) we are looking for | 540 | // Find HBA (host bus adapter) we are looking for |
540 | down(&adpt_configuration_lock); | 541 | mutex_lock(&adpt_configuration_lock); |
541 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 542 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
542 | if (pHba->host == host) { | 543 | if (pHba->host == host) { |
543 | break; /* found adapter */ | 544 | break; /* found adapter */ |
544 | } | 545 | } |
545 | } | 546 | } |
546 | up(&adpt_configuration_lock); | 547 | mutex_unlock(&adpt_configuration_lock); |
547 | if (pHba == NULL) { | 548 | if (pHba == NULL) { |
548 | return 0; | 549 | return 0; |
549 | } | 550 | } |
@@ -958,7 +959,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev | |||
958 | } | 959 | } |
959 | memset(pHba, 0, sizeof(adpt_hba)); | 960 | memset(pHba, 0, sizeof(adpt_hba)); |
960 | 961 | ||
961 | down(&adpt_configuration_lock); | 962 | mutex_lock(&adpt_configuration_lock); |
962 | 963 | ||
963 | if(hba_chain != NULL){ | 964 | if(hba_chain != NULL){ |
964 | for(p = hba_chain; p->next; p = p->next); | 965 | 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 | |||
971 | sprintf(pHba->name, "dpti%d", hba_count); | 972 | sprintf(pHba->name, "dpti%d", hba_count); |
972 | hba_count++; | 973 | hba_count++; |
973 | 974 | ||
974 | up(&adpt_configuration_lock); | 975 | mutex_unlock(&adpt_configuration_lock); |
975 | 976 | ||
976 | pHba->pDev = pDev; | 977 | pHba->pDev = pDev; |
977 | pHba->base_addr_phys = base_addr0_phys; | 978 | pHba->base_addr_phys = base_addr0_phys; |
@@ -1027,7 +1028,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1027 | struct adpt_device* pNext; | 1028 | struct adpt_device* pNext; |
1028 | 1029 | ||
1029 | 1030 | ||
1030 | down(&adpt_configuration_lock); | 1031 | mutex_lock(&adpt_configuration_lock); |
1031 | // scsi_unregister calls our adpt_release which | 1032 | // scsi_unregister calls our adpt_release which |
1032 | // does a quiese | 1033 | // does a quiese |
1033 | if(pHba->host){ | 1034 | if(pHba->host){ |
@@ -1046,7 +1047,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1046 | } | 1047 | } |
1047 | 1048 | ||
1048 | hba_count--; | 1049 | hba_count--; |
1049 | up(&adpt_configuration_lock); | 1050 | mutex_unlock(&adpt_configuration_lock); |
1050 | 1051 | ||
1051 | iounmap(pHba->base_addr_virt); | 1052 | iounmap(pHba->base_addr_virt); |
1052 | pci_release_regions(pHba->pDev); | 1053 | pci_release_regions(pHba->pDev); |
@@ -1549,7 +1550,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba) | |||
1549 | 1550 | ||
1550 | static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d) | 1551 | static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d) |
1551 | { | 1552 | { |
1552 | down(&adpt_configuration_lock); | 1553 | mutex_lock(&adpt_configuration_lock); |
1553 | d->controller=pHba; | 1554 | d->controller=pHba; |
1554 | d->owner=NULL; | 1555 | d->owner=NULL; |
1555 | d->next=pHba->devices; | 1556 | d->next=pHba->devices; |
@@ -1560,7 +1561,7 @@ static int adpt_i2o_install_device(adpt_hba* pHba, struct i2o_device *d) | |||
1560 | pHba->devices=d; | 1561 | pHba->devices=d; |
1561 | *d->dev_name = 0; | 1562 | *d->dev_name = 0; |
1562 | 1563 | ||
1563 | up(&adpt_configuration_lock); | 1564 | mutex_unlock(&adpt_configuration_lock); |
1564 | return 0; | 1565 | return 0; |
1565 | } | 1566 | } |
1566 | 1567 | ||
@@ -1575,24 +1576,24 @@ static int adpt_open(struct inode *inode, struct file *file) | |||
1575 | if (minor >= hba_count) { | 1576 | if (minor >= hba_count) { |
1576 | return -ENXIO; | 1577 | return -ENXIO; |
1577 | } | 1578 | } |
1578 | down(&adpt_configuration_lock); | 1579 | mutex_lock(&adpt_configuration_lock); |
1579 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 1580 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
1580 | if (pHba->unit == minor) { | 1581 | if (pHba->unit == minor) { |
1581 | break; /* found adapter */ | 1582 | break; /* found adapter */ |
1582 | } | 1583 | } |
1583 | } | 1584 | } |
1584 | if (pHba == NULL) { | 1585 | if (pHba == NULL) { |
1585 | up(&adpt_configuration_lock); | 1586 | mutex_unlock(&adpt_configuration_lock); |
1586 | return -ENXIO; | 1587 | return -ENXIO; |
1587 | } | 1588 | } |
1588 | 1589 | ||
1589 | // if(pHba->in_use){ | 1590 | // if(pHba->in_use){ |
1590 | // up(&adpt_configuration_lock); | 1591 | // mutex_unlock(&adpt_configuration_lock); |
1591 | // return -EBUSY; | 1592 | // return -EBUSY; |
1592 | // } | 1593 | // } |
1593 | 1594 | ||
1594 | pHba->in_use = 1; | 1595 | pHba->in_use = 1; |
1595 | up(&adpt_configuration_lock); | 1596 | mutex_unlock(&adpt_configuration_lock); |
1596 | 1597 | ||
1597 | return 0; | 1598 | return 0; |
1598 | } | 1599 | } |
@@ -1606,13 +1607,13 @@ static int adpt_close(struct inode *inode, struct file *file) | |||
1606 | if (minor >= hba_count) { | 1607 | if (minor >= hba_count) { |
1607 | return -ENXIO; | 1608 | return -ENXIO; |
1608 | } | 1609 | } |
1609 | down(&adpt_configuration_lock); | 1610 | mutex_lock(&adpt_configuration_lock); |
1610 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 1611 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
1611 | if (pHba->unit == minor) { | 1612 | if (pHba->unit == minor) { |
1612 | break; /* found adapter */ | 1613 | break; /* found adapter */ |
1613 | } | 1614 | } |
1614 | } | 1615 | } |
1615 | up(&adpt_configuration_lock); | 1616 | mutex_unlock(&adpt_configuration_lock); |
1616 | if (pHba == NULL) { | 1617 | if (pHba == NULL) { |
1617 | return -ENXIO; | 1618 | return -ENXIO; |
1618 | } | 1619 | } |
@@ -1910,13 +1911,13 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, | |||
1910 | if (minor >= DPTI_MAX_HBA){ | 1911 | if (minor >= DPTI_MAX_HBA){ |
1911 | return -ENXIO; | 1912 | return -ENXIO; |
1912 | } | 1913 | } |
1913 | down(&adpt_configuration_lock); | 1914 | mutex_lock(&adpt_configuration_lock); |
1914 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 1915 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
1915 | if (pHba->unit == minor) { | 1916 | if (pHba->unit == minor) { |
1916 | break; /* found adapter */ | 1917 | break; /* found adapter */ |
1917 | } | 1918 | } |
1918 | } | 1919 | } |
1919 | up(&adpt_configuration_lock); | 1920 | mutex_unlock(&adpt_configuration_lock); |
1920 | if(pHba == NULL){ | 1921 | if(pHba == NULL){ |
1921 | return -ENXIO; | 1922 | return -ENXIO; |
1922 | } | 1923 | } |