Skip to content

Commit 6c2f527

Browse files
mkaehlckeJames Bottomley
authored andcommitted
[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: Matthias Kaehlcke <matthias@kaehlcke.net> Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
1 parent e1e82b6 commit 6c2f527

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,10 +1176,10 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
11761176
qla24xx_disable_vp(vha);
11771177
qla24xx_deallocate_vp_id(vha);
11781178

1179-
down(&ha->vport_sem);
1179+
mutex_lock(&ha->vport_lock);
11801180
ha->cur_vport_count--;
11811181
clear_bit(vha->vp_idx, ha->vp_idx_map);
1182-
up(&ha->vport_sem);
1182+
mutex_unlock(&ha->vport_lock);
11831183

11841184
kfree(vha->node_name);
11851185
kfree(vha->port_name);

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ typedef struct scsi_qla_host {
24572457
#define MBX_INTR_WAIT 2
24582458
#define MBX_UPDATE_FLASH_ACTIVE 3
24592459

2460-
struct semaphore vport_sem; /* Virtual port synchronization */
2460+
struct mutex vport_lock; /* Virtual port synchronization */
24612461
struct completion mbx_cmd_comp; /* Serialize mbx access */
24622462
struct completion mbx_intr_comp; /* Used for completion notification */
24632463

drivers/scsi/qla2xxx/qla_mbx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,9 +2807,9 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
28072807
*/
28082808
map = (vp_index - 1) / 8;
28092809
pos = (vp_index - 1) & 7;
2810-
down(&ha->vport_sem);
2810+
mutex_lock(&ha->vport_lock);
28112811
vce->vp_idx_map[map] |= 1 << pos;
2812-
up(&ha->vport_sem);
2812+
mutex_unlock(&ha->vport_lock);
28132813

28142814
rval = qla2x00_issue_iocb(ha, vce, vce_dma, 0);
28152815
if (rval != QLA_SUCCESS) {

drivers/scsi/qla2xxx/qla_mid.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
3232
scsi_qla_host_t *ha = vha->parent;
3333

3434
/* Find an empty slot and assign an vp_id */
35-
down(&ha->vport_sem);
35+
mutex_lock(&ha->vport_lock);
3636
vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1);
3737
if (vp_id > ha->max_npiv_vports) {
3838
DEBUG15(printk ("vp_id %d is bigger than max-supported %d.\n",
3939
vp_id, ha->max_npiv_vports));
40-
up(&ha->vport_sem);
40+
mutex_unlock(&ha->vport_lock);
4141
return vp_id;
4242
}
4343

4444
set_bit(vp_id, ha->vp_idx_map);
4545
ha->num_vhosts++;
4646
vha->vp_idx = vp_id;
4747
list_add_tail(&vha->vp_list, &ha->vp_list);
48-
up(&ha->vport_sem);
48+
mutex_unlock(&ha->vport_lock);
4949
return vp_id;
5050
}
5151

@@ -55,12 +55,12 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
5555
uint16_t vp_id;
5656
scsi_qla_host_t *ha = vha->parent;
5757

58-
down(&ha->vport_sem);
58+
mutex_lock(&ha->vport_lock);
5959
vp_id = vha->vp_idx;
6060
ha->num_vhosts--;
6161
clear_bit(vp_id, ha->vp_idx_map);
6262
list_del(&vha->vp_list);
63-
up(&ha->vport_sem);
63+
mutex_unlock(&ha->vport_lock);
6464
}
6565

6666
static scsi_qla_host_t *
@@ -145,9 +145,9 @@ qla24xx_enable_vp(scsi_qla_host_t *vha)
145145
}
146146

147147
/* Initialize the new vport unless it is a persistent port */
148-
down(&ha->vport_sem);
148+
mutex_lock(&ha->vport_lock);
149149
ret = qla24xx_modify_vp_config(vha);
150-
up(&ha->vport_sem);
150+
mutex_unlock(&ha->vport_lock);
151151

152152
if (ret != QLA_SUCCESS) {
153153
fc_vport_set_state(vha->fc_vport, FC_VPORT_FAILED);
@@ -437,10 +437,10 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
437437
vha->flags.init_done = 1;
438438
num_hosts++;
439439

440-
down(&ha->vport_sem);
440+
mutex_lock(&ha->vport_lock);
441441
set_bit(vha->vp_idx, ha->vp_idx_map);
442442
ha->cur_vport_count++;
443-
up(&ha->vport_sem);
443+
mutex_unlock(&ha->vport_lock);
444444

445445
return vha;
446446

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
16321632
/* load the F/W, read paramaters, and init the H/W */
16331633
ha->instance = num_hosts;
16341634

1635-
init_MUTEX(&ha->vport_sem);
1635+
mutex_init(&ha->vport_lock);
16361636
init_completion(&ha->mbx_cmd_comp);
16371637
complete(&ha->mbx_cmd_comp);
16381638
init_completion(&ha->mbx_intr_comp);

0 commit comments

Comments
 (0)