diff mbox series

[2/4] target_core_pscsi: use __scsi_device_lookup()

Message ID 20200528163625.110184-3-hare@suse.de (mailing list archive)
State Superseded
Headers show
Series scsi: use xarray for devices and targets | expand

Commit Message

Hannes Reinecke May 28, 2020, 4:36 p.m. UTC
Instead of walking the list of devices manually use the helper
function to return the device directly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 drivers/target/target_core_pscsi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Bart Van Assche May 28, 2020, 5:55 p.m. UTC | #1
On 2020-05-28 09:36, Hannes Reinecke wrote:
> Instead of walking the list of devices manually use the helper
> function to return the device directly.

Reviewed-by: Bart van Assche <bvanassche@acm.org>
Daniel Wagner May 29, 2020, 7:02 a.m. UTC | #2
On Thu, May 28, 2020 at 06:36:23PM +0200, Hannes Reinecke wrote:
> Instead of walking the list of devices manually use the helper
> function to return the device directly.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Reviewed-by: Daniel Wagner <dwagner@suse.de>
diff mbox series

Patch

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 4e37fa9b409d..38799e47b590 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -496,11 +496,9 @@  static int pscsi_configure_device(struct se_device *dev)
 	}
 
 	spin_lock_irq(sh->host_lock);
-	list_for_each_entry(sd, &sh->__devices, siblings) {
-		if ((pdv->pdv_channel_id != sd->channel) ||
-		    (pdv->pdv_target_id != sd->id) ||
-		    (pdv->pdv_lun_id != sd->lun))
-			continue;
+	sd = __scsi_device_lookup(sh, pdv->pdv_channel_id,
+				  pdv->pdv_target_id, pdv->pdv_lun_id);
+	if (sd) {
 		/*
 		 * Functions will release the held struct scsi_host->host_lock
 		 * before calling calling pscsi_add_device_to_list() to register