diff mbox

[1/2] scsi_transport_fc: Introduce scsi_host_{get,put}()

Message ID 564F9190.5090103@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bart Van Assche Nov. 20, 2015, 9:33 p.m. UTC
Use scsi_host_{get,put}() instead of open-coding these functions.
Compile-tested only.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: James Smart <james.smart@emulex.com>
Cc: stable <stable@vger.kernel.org>
---
 drivers/scsi/scsi_transport_fc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Christoph Hellwig Nov. 22, 2015, 3:03 p.m. UTC | #1
On Fri, Nov 20, 2015 at 01:33:04PM -0800, Bart Van Assche wrote:
> Use scsi_host_{get,put}() instead of open-coding these functions.
> Compile-tested only.

s/Introdue/use/ in the subject?

Otherwise this looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Thumshirn Nov. 24, 2015, 12:43 p.m. UTC | #2
On Fri, 2015-11-20 at 13:33 -0800, Bart Van Assche wrote:
> Use scsi_host_{get,put}() instead of open-coding these functions.
> Compile-tested only.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: James Smart <james.smart@emulex.com>
> Cc: stable <stable@vger.kernel.org>
> ---
>  drivers/scsi/scsi_transport_fc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_transport_fc.c
> b/drivers/scsi/scsi_transport_fc.c
> index 24eaaf6..8a88226 100644
> --- a/drivers/scsi/scsi_transport_fc.c
> +++ b/drivers/scsi/scsi_transport_fc.c
> @@ -2586,7 +2586,7 @@ fc_rport_final_delete(struct work_struct *work)
>  	transport_remove_device(dev);
>  	device_del(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 */
>  }
>  
> @@ -2650,7 +2650,7 @@ fc_rport_create(struct Scsi_Host *shost, int
> channel,
>  	else
>  		rport->scsi_target_id = -1;
>  	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);
>  
> @@ -2685,7 +2685,7 @@ delete_rport:
>  	transport_destroy_device(dev);
>  	spin_lock_irqsave(shost->host_lock, flags);
>  	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);
>  	put_device(dev->parent);
>  	kfree(rport);
> @@ -3383,7 +3383,7 @@ fc_vport_setup(struct Scsi_Host *shost, int
> channel, struct device *pdev,
>  	fc_host->npiv_vports_inuse++;
>  	vport->number = fc_host->next_vport_number++;
>  	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);
>  
> @@ -3441,7 +3441,7 @@ delete_vport:
>  	transport_destroy_device(dev);
>  	spin_lock_irqsave(shost->host_lock, flags);
>  	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--;
>  	spin_unlock_irqrestore(shost->host_lock, flags);
>  	put_device(dev->parent);
> @@ -3504,7 +3504,7 @@ fc_vport_terminate(struct fc_vport *vport)
>  		vport->flags |= FC_VPORT_DELETED;
>  		list_del(&vport->peers);
>  		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);
>  

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen Nov. 30, 2015, 5:34 p.m. UTC | #3
>>>>> "Bart" == Bart Van Assche <bart.vanassche@sandisk.com> writes:

Bart,

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

Do you want me to queue this as a general cleanup for 4.5 (independently
of the leak patch)?
Bart Van Assche Nov. 30, 2015, 5:37 p.m. UTC | #4
On 11/30/2015 09:34 AM, Martin K. Petersen wrote:
>>>>>> "Bart" == Bart Van Assche <bart.vanassche@sandisk.com> writes:
>
> Bart,
>
> Bart> Use scsi_host_{get,put}() instead of open-coding these functions.
> Bart> Compile-tested only.
>
> Do you want me to queue this as a general cleanup for 4.5 (independently
> of the leak patch)?

Hello Martin,

That would be appreciated.

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen Nov. 30, 2015, 10:47 p.m. UTC | #5
>>>>> "Bart" == Bart Van Assche <bart.vanassche@sandisk.com> writes:

>> Do you want me to queue this as a general cleanup for 4.5
>> (independently of the leak patch)?

Bart> That would be appreciated.

OK. Done.
diff mbox

Patch

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 24eaaf6..8a88226 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2586,7 +2586,7 @@  fc_rport_final_delete(struct work_struct *work)
 	transport_remove_device(dev);
 	device_del(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 */
 }
 
@@ -2650,7 +2650,7 @@  fc_rport_create(struct Scsi_Host *shost, int channel,
 	else
 		rport->scsi_target_id = -1;
 	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);
 
@@ -2685,7 +2685,7 @@  delete_rport:
 	transport_destroy_device(dev);
 	spin_lock_irqsave(shost->host_lock, flags);
 	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);
 	put_device(dev->parent);
 	kfree(rport);
@@ -3383,7 +3383,7 @@  fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
 	fc_host->npiv_vports_inuse++;
 	vport->number = fc_host->next_vport_number++;
 	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);
 
@@ -3441,7 +3441,7 @@  delete_vport:
 	transport_destroy_device(dev);
 	spin_lock_irqsave(shost->host_lock, flags);
 	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--;
 	spin_unlock_irqrestore(shost->host_lock, flags);
 	put_device(dev->parent);
@@ -3504,7 +3504,7 @@  fc_vport_terminate(struct fc_vport *vport)
 		vport->flags |= FC_VPORT_DELETED;
 		list_del(&vport->peers);
 		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);