aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_mid.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mid.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index f2b04979e5f0..62a3ad6e8ecb 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -32,12 +32,12 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
32 scsi_qla_host_t *ha = vha->parent; 32 scsi_qla_host_t *ha = vha->parent;
33 33
34 /* Find an empty slot and assign an vp_id */ 34 /* Find an empty slot and assign an vp_id */
35 down(&ha->vport_sem); 35 mutex_lock(&ha->vport_lock);
36 vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1); 36 vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1);
37 if (vp_id > ha->max_npiv_vports) { 37 if (vp_id > ha->max_npiv_vports) {
38 DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n", 38 DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n",
39 vp_id, ha->max_npiv_vports)); 39 vp_id, ha->max_npiv_vports));
40 up(&ha->vport_sem); 40 mutex_unlock(&ha->vport_lock);
41 return vp_id; 41 return vp_id;
42 } 42 }
43 43
@@ -45,7 +45,7 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
45 ha->num_vhosts++; 45 ha->num_vhosts++;
46 vha->vp_idx = vp_id; 46 vha->vp_idx = vp_id;
47 list_add_tail(&vha->vp_list, &ha->vp_list); 47 list_add_tail(&vha->vp_list, &ha->vp_list);
48 up(&ha->vport_sem); 48 mutex_unlock(&ha->vport_lock);
49 return vp_id; 49 return vp_id;
50} 50}
51 51
@@ -55,12 +55,12 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
55 uint16_t vp_id; 55 uint16_t vp_id;
56 scsi_qla_host_t *ha = vha->parent; 56 scsi_qla_host_t *ha = vha->parent;
57 57
58 down(&ha->vport_sem); 58 mutex_lock(&ha->vport_lock);
59 vp_id = vha->vp_idx; 59 vp_id = vha->vp_idx;
60 ha->num_vhosts--; 60 ha->num_vhosts--;
61 clear_bit(vp_id, ha->vp_idx_map); 61 clear_bit(vp_id, ha->vp_idx_map);
62 list_del(&vha->vp_list); 62 list_del(&vha->vp_list);
63 up(&ha->vport_sem); 63 mutex_unlock(&ha->vport_lock);
64} 64}
65 65
66static scsi_qla_host_t * 66static scsi_qla_host_t *
@@ -145,9 +145,9 @@ qla24xx_enable_vp(scsi_qla_host_t *vha)
145 } 145 }
146 146
147 /* Initialize the new vport unless it is a persistent port */ 147 /* Initialize the new vport unless it is a persistent port */
148 down(&ha->vport_sem); 148 mutex_lock(&ha->vport_lock);
149 ret = qla24xx_modify_vp_config(vha); 149 ret = qla24xx_modify_vp_config(vha);
150 up(&ha->vport_sem); 150 mutex_unlock(&ha->vport_lock);
151 151
152 if (ret != QLA_SUCCESS) { 152 if (ret != QLA_SUCCESS) {
153 fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED); 153 fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED);
@@ -406,6 +406,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
406 INIT_LIST_HEAD(&vha->list); 406 INIT_LIST_HEAD(&vha->list);
407 INIT_LIST_HEAD(&vha->fcports); 407 INIT_LIST_HEAD(&vha->fcports);
408 INIT_LIST_HEAD(&vha->vp_fcports); 408 INIT_LIST_HEAD(&vha->vp_fcports);
409 INIT_LIST_HEAD(&vha->work_list);
409 410
410 vha->dpc_flags = 0L; 411 vha->dpc_flags = 0L;
411 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags); 412 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags);
@@ -437,10 +438,10 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
437 vha->flags.init_done = 1; 438 vha->flags.init_done = 1;
438 num_hosts++; 439 num_hosts++;
439 440
440 down(&ha->vport_sem); 441 mutex_lock(&ha->vport_lock);
441 set_bit(vha->vp_idx, ha->vp_idx_map); 442 set_bit(vha->vp_idx, ha->vp_idx_map);
442 ha->cur_vport_count++; 443 ha->cur_vport_count++;
443 up(&ha->vport_sem); 444 mutex_unlock(&ha->vport_lock);
444 445
445 return vha; 446 return vha;
446 447