Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 18424
b: refs/heads/master
c: 0b95067
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and James Bottomley committed Jan 12, 2006
1 parent d338f93 commit ecf4498
Show file tree
Hide file tree
Showing 18 changed files with 132 additions and 121 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dacee84b070c4e705a5b6446f1f0a6a6e2f8d7a4
refs/heads/master: 0b9506723826c68b50fa33e345700ddcac1bed36
33 changes: 17 additions & 16 deletions trunk/drivers/scsi/ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/completion.h>
#include <linux/compat.h>
#include <linux/chio.h> /* here are all the ioctls */
#include <linux/mutex.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
Expand Down Expand Up @@ -111,7 +112,7 @@ typedef struct {
u_int counts[CH_TYPES];
u_int unit_attention;
u_int voltags;
struct semaphore lock;
struct mutex lock;
} scsi_changer;

static LIST_HEAD(ch_devlist);
Expand Down Expand Up @@ -565,7 +566,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest)
u_char data[16];
unsigned int i;

down(&ch->lock);
mutex_lock(&ch->lock);
for (i = 0; i < ch->counts[type]; i++) {
if (0 != ch_read_element_status
(ch, ch->firsts[type]+i,data)) {
Expand All @@ -582,7 +583,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest)
if (0 != retval)
break;
}
up(&ch->lock);
mutex_unlock(&ch->lock);
return retval;
}

Expand Down Expand Up @@ -687,11 +688,11 @@ static int ch_ioctl(struct inode * inode, struct file * file,
dprintk("CHIOPOSITION: invalid parameter\n");
return -EBADSLT;
}
down(&ch->lock);
mutex_lock(&ch->lock);
retval = ch_position(ch,0,
ch->firsts[pos.cp_type] + pos.cp_unit,
pos.cp_flags & CP_INVERT);
up(&ch->lock);
mutex_unlock(&ch->lock);
return retval;
}

Expand All @@ -708,12 +709,12 @@ static int ch_ioctl(struct inode * inode, struct file * file,
return -EBADSLT;
}

down(&ch->lock);
mutex_lock(&ch->lock);
retval = ch_move(ch,0,
ch->firsts[mv.cm_fromtype] + mv.cm_fromunit,
ch->firsts[mv.cm_totype] + mv.cm_tounit,
mv.cm_flags & CM_INVERT);
up(&ch->lock);
mutex_unlock(&ch->lock);
return retval;
}

Expand All @@ -731,14 +732,14 @@ static int ch_ioctl(struct inode * inode, struct file * file,
return -EBADSLT;
}

down(&ch->lock);
mutex_lock(&ch->lock);
retval = ch_exchange
(ch,0,
ch->firsts[mv.ce_srctype] + mv.ce_srcunit,
ch->firsts[mv.ce_fdsttype] + mv.ce_fdstunit,
ch->firsts[mv.ce_sdsttype] + mv.ce_sdstunit,
mv.ce_flags & CE_INVERT1, mv.ce_flags & CE_INVERT2);
up(&ch->lock);
mutex_unlock(&ch->lock);
return retval;
}

Expand Down Expand Up @@ -772,7 +773,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
if (!buffer)
return -ENOMEM;
down(&ch->lock);
mutex_lock(&ch->lock);

voltag_retry:
memset(cmd,0,sizeof(cmd));
Expand Down Expand Up @@ -823,7 +824,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
goto voltag_retry;
}
kfree(buffer);
up(&ch->lock);
mutex_unlock(&ch->lock);

if (copy_to_user(argp, &cge, sizeof (cge)))
return -EFAULT;
Expand All @@ -832,9 +833,9 @@ static int ch_ioctl(struct inode * inode, struct file * file,

case CHIOINITELEM:
{
down(&ch->lock);
mutex_lock(&ch->lock);
retval = ch_init_elem(ch);
up(&ch->lock);
mutex_unlock(&ch->lock);
return retval;
}

Expand All @@ -851,12 +852,12 @@ static int ch_ioctl(struct inode * inode, struct file * file,
return -EBADSLT;
}
elem = ch->firsts[csv.csv_type] + csv.csv_unit;
down(&ch->lock);
mutex_lock(&ch->lock);
retval = ch_set_voltag(ch, elem,
csv.csv_flags & CSV_AVOLTAG,
csv.csv_flags & CSV_CLEARTAG,
csv.csv_voltag);
up(&ch->lock);
mutex_unlock(&ch->lock);
return retval;
}

Expand Down Expand Up @@ -929,7 +930,7 @@ static int ch_probe(struct device *dev)
memset(ch,0,sizeof(*ch));
ch->minor = ch_devcount;
sprintf(ch->name,"ch%d",ch->minor);
init_MUTEX(&ch->lock);
mutex_init(&ch->lock);
ch->device = sd;
ch_readconfig(ch);
if (init)
Expand Down
35 changes: 18 additions & 17 deletions trunk/drivers/scsi/dpt_i2o.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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){
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/scsi/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,16 @@ EXPORT_SYMBOL(scsi_host_set_state);
void scsi_remove_host(struct Scsi_Host *shost)
{
unsigned long flags;
down(&shost->scan_mutex);
mutex_lock(&shost->scan_mutex);
spin_lock_irqsave(shost->host_lock, flags);
if (scsi_host_set_state(shost, SHOST_CANCEL))
if (scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY)) {
spin_unlock_irqrestore(shost->host_lock, flags);
up(&shost->scan_mutex);
mutex_unlock(&shost->scan_mutex);
return;
}
spin_unlock_irqrestore(shost->host_lock, flags);
up(&shost->scan_mutex);
mutex_unlock(&shost->scan_mutex);
scsi_forget_host(shost);
scsi_proc_host_rm(shost);

Expand Down Expand Up @@ -320,7 +320,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
INIT_LIST_HEAD(&shost->starved_list);
init_waitqueue_head(&shost->host_wait);

init_MUTEX(&shost->scan_mutex);
mutex_init(&shost->scan_mutex);

shost->host_no = scsi_host_next_hn++; /* XXX(hch): still racy */
shost->dma_channel = 0xff;
Expand Down
Loading

0 comments on commit ecf4498

Please sign in to comment.