Commit 4cd38e38 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi_transport_fc: Introduce scsi_host_{get,put}()

Use scsi_host_{get,put}() instead of open-coding these functions.
Compile-tested only.

[mkp: Dropped CC:stable and fixed James Smart's email address]
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: James Smart <james.smart@avagotech.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent fa785f0a
...@@ -2586,7 +2586,7 @@ fc_rport_final_delete(struct work_struct *work) ...@@ -2586,7 +2586,7 @@ fc_rport_final_delete(struct work_struct *work)
transport_remove_device(dev); transport_remove_device(dev);
device_del(dev); device_del(dev);
transport_destroy_device(dev); transport_destroy_device(dev);
put_device(&shost->shost_gendev); /* for fc_host->rport list */ scsi_host_put(shost); /* for fc_host->rport list */
put_device(dev); /* for self-reference */ put_device(dev); /* for self-reference */
} }
...@@ -2650,7 +2650,7 @@ fc_rport_create(struct Scsi_Host *shost, int channel, ...@@ -2650,7 +2650,7 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
else else
rport->scsi_target_id = -1; rport->scsi_target_id = -1;
list_add_tail(&rport->peers, &fc_host->rports); list_add_tail(&rport->peers, &fc_host->rports);
get_device(&shost->shost_gendev); /* for fc_host->rport list */ scsi_host_get(shost); /* for fc_host->rport list */
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
...@@ -2685,7 +2685,7 @@ fc_rport_create(struct Scsi_Host *shost, int channel, ...@@ -2685,7 +2685,7 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
transport_destroy_device(dev); transport_destroy_device(dev);
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
list_del(&rport->peers); list_del(&rport->peers);
put_device(&shost->shost_gendev); /* for fc_host->rport list */ scsi_host_put(shost); /* for fc_host->rport list */
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
put_device(dev->parent); put_device(dev->parent);
kfree(rport); kfree(rport);
...@@ -3383,7 +3383,7 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev, ...@@ -3383,7 +3383,7 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
fc_host->npiv_vports_inuse++; fc_host->npiv_vports_inuse++;
vport->number = fc_host->next_vport_number++; vport->number = fc_host->next_vport_number++;
list_add_tail(&vport->peers, &fc_host->vports); list_add_tail(&vport->peers, &fc_host->vports);
get_device(&shost->shost_gendev); /* for fc_host->vport list */ scsi_host_get(shost); /* for fc_host->vport list */
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
...@@ -3441,7 +3441,7 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev, ...@@ -3441,7 +3441,7 @@ fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
transport_destroy_device(dev); transport_destroy_device(dev);
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
list_del(&vport->peers); list_del(&vport->peers);
put_device(&shost->shost_gendev); /* for fc_host->vport list */ scsi_host_put(shost); /* for fc_host->vport list */
fc_host->npiv_vports_inuse--; fc_host->npiv_vports_inuse--;
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
put_device(dev->parent); put_device(dev->parent);
...@@ -3504,7 +3504,7 @@ fc_vport_terminate(struct fc_vport *vport) ...@@ -3504,7 +3504,7 @@ fc_vport_terminate(struct fc_vport *vport)
vport->flags |= FC_VPORT_DELETED; vport->flags |= FC_VPORT_DELETED;
list_del(&vport->peers); list_del(&vport->peers);
fc_host->npiv_vports_inuse--; fc_host->npiv_vports_inuse--;
put_device(&shost->shost_gendev); /* for fc_host->vport list */ scsi_host_put(shost); /* for fc_host->vport list */
} }
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
......
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