Commit 6c2f527c authored by matthias@kaehlcke.net's avatar matthias@kaehlcke.net Committed by James Bottomley

[SCSI] qla2xxx: Convert vport_sem to a mutex

The semaphore vport_sem is used as a mutex.  Convert it to the
mutex API.
Signed-off-by: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent e1e82b6f
...@@ -1176,10 +1176,10 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) ...@@ -1176,10 +1176,10 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
qla24xx_disable_vp(vha); qla24xx_disable_vp(vha);
qla24xx_deallocate_vp_id(vha); qla24xx_deallocate_vp_id(vha);
down(&ha->vport_sem); mutex_lock(&ha->vport_lock);
ha->cur_vport_count--; ha->cur_vport_count--;
clear_bit(vha->vp_idx, ha->vp_idx_map); clear_bit(vha->vp_idx, ha->vp_idx_map);
up(&ha->vport_sem); mutex_unlock(&ha->vport_lock);
kfree(vha->node_name); kfree(vha->node_name);
kfree(vha->port_name); kfree(vha->port_name);
......
...@@ -2457,7 +2457,7 @@ typedef struct scsi_qla_host { ...@@ -2457,7 +2457,7 @@ typedef struct scsi_qla_host {
#define MBX_INTR_WAIT 2 #define MBX_INTR_WAIT 2
#define MBX_UPDATE_FLASH_ACTIVE 3 #define MBX_UPDATE_FLASH_ACTIVE 3
struct semaphore vport_sem; /* Virtual port synchronization */ struct mutex vport_lock; /* Virtual port synchronization */
struct completion mbx_cmd_comp; /* Serialize mbx access */ struct completion mbx_cmd_comp; /* Serialize mbx access */
struct completion mbx_intr_comp; /* Used for completion notification */ struct completion mbx_intr_comp; /* Used for completion notification */
......
...@@ -2807,9 +2807,9 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) ...@@ -2807,9 +2807,9 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
*/ */
map = (vp_index - 1) / 8; map = (vp_index - 1) / 8;
pos = (vp_index - 1) & 7; pos = (vp_index - 1) & 7;
down(&ha->vport_sem); mutex_lock(&ha->vport_lock);
vce->vp_idx_map[map] |= 1 << pos; vce->vp_idx_map[map] |= 1 << pos;
up(&ha->vport_sem); mutex_unlock(&ha->vport_lock);
rval = qla2x00_issue_iocb(ha, vce, vce_dma, 0); rval = qla2x00_issue_iocb(ha, vce, vce_dma, 0);
if (rval != QLA_SUCCESS) { if (rval != QLA_SUCCESS) {
......
...@@ -32,12 +32,12 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) ...@@ -32,12 +32,12 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
scsi_qla_host_t *ha = vha->parent; scsi_qla_host_t *ha = vha->parent;
/* Find an empty slot and assign an vp_id */ /* Find an empty slot and assign an vp_id */
down(&ha->vport_sem); mutex_lock(&ha->vport_lock);
vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1); vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1);
if (vp_id > ha->max_npiv_vports) { if (vp_id > ha->max_npiv_vports) {
DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n", DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n",
vp_id, ha->max_npiv_vports)); vp_id, ha->max_npiv_vports));
up(&ha->vport_sem); mutex_unlock(&ha->vport_lock);
return vp_id; return vp_id;
} }
...@@ -45,7 +45,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) ...@@ -45,7 +45,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
ha->num_vhosts++; ha->num_vhosts++;
vha->vp_idx = vp_id; vha->vp_idx = vp_id;
list_add_tail(&vha->vp_list, &ha->vp_list); list_add_tail(&vha->vp_list, &ha->vp_list);
up(&ha->vport_sem); mutex_unlock(&ha->vport_lock);
return vp_id; return vp_id;
} }
...@@ -55,12 +55,12 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha) ...@@ -55,12 +55,12 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
uint16_t vp_id; uint16_t vp_id;
scsi_qla_host_t *ha = vha->parent; scsi_qla_host_t *ha = vha->parent;
down(&ha->vport_sem); mutex_lock(&ha->vport_lock);
vp_id = vha->vp_idx; vp_id = vha->vp_idx;
ha->num_vhosts--; ha->num_vhosts--;
clear_bit(vp_id, ha->vp_idx_map); clear_bit(vp_id, ha->vp_idx_map);
list_del(&vha->vp_list); list_del(&vha->vp_list);
up(&ha->vport_sem); mutex_unlock(&ha->vport_lock);
} }
static scsi_qla_host_t * static scsi_qla_host_t *
...@@ -145,9 +145,9 @@ qla24xx_enable_vp(scsi_qla_host_t *vha) ...@@ -145,9 +145,9 @@ qla24xx_enable_vp(scsi_qla_host_t *vha)
} }
/* Initialize the new vport unless it is a persistent port */ /* Initialize the new vport unless it is a persistent port */
down(&ha->vport_sem); mutex_lock(&ha->vport_lock);
ret = qla24xx_modify_vp_config(vha); ret = qla24xx_modify_vp_config(vha);
up(&ha->vport_sem); mutex_unlock(&ha->vport_lock);
if (ret != QLA_SUCCESS) { if (ret != QLA_SUCCESS) {
fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED); fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED);
...@@ -437,10 +437,10 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) ...@@ -437,10 +437,10 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
vha->flags.init_done = 1; vha->flags.init_done = 1;
num_hosts++; num_hosts++;
down(&ha->vport_sem); mutex_lock(&ha->vport_lock);
set_bit(vha->vp_idx, ha->vp_idx_map); set_bit(vha->vp_idx, ha->vp_idx_map);
ha->cur_vport_count++; ha->cur_vport_count++;
up(&ha->vport_sem); mutex_unlock(&ha->vport_lock);
return vha; return vha;
......
...@@ -1632,7 +1632,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1632,7 +1632,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
/* load the F/W, read paramaters, and init the H/W */ /* load the F/W, read paramaters, and init the H/W */
ha->instance = num_hosts; ha->instance = num_hosts;
init_MUTEX(&ha->vport_sem); mutex_init(&ha->vport_lock);
init_completion(&ha->mbx_cmd_comp); init_completion(&ha->mbx_cmd_comp);
complete(&ha->mbx_cmd_comp); complete(&ha->mbx_cmd_comp);
init_completion(&ha->mbx_intr_comp); init_completion(&ha->mbx_intr_comp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment