aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c57
1 files changed, 18 insertions, 39 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 6f121a904d05..72a945373964 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -484,27 +484,17 @@ struct _sas_device *
484mpt2sas_scsih_sas_device_find_by_sas_address(struct MPT2SAS_ADAPTER *ioc, 484mpt2sas_scsih_sas_device_find_by_sas_address(struct MPT2SAS_ADAPTER *ioc,
485 u64 sas_address) 485 u64 sas_address)
486{ 486{
487 struct _sas_device *sas_device, *r; 487 struct _sas_device *sas_device;
488 488
489 r = NULL; 489 list_for_each_entry(sas_device, &ioc->sas_device_list, list)
490 /* check the sas_device_init_list */ 490 if (sas_device->sas_address == sas_address)
491 list_for_each_entry(sas_device, &ioc->sas_device_init_list, 491 return sas_device;
492 list) {
493 if (sas_device->sas_address != sas_address)
494 continue;
495 r = sas_device;
496 goto out;
497 }
498 492
499 /* then check the sas_device_list */ 493 list_for_each_entry(sas_device, &ioc->sas_device_init_list, list)
500 list_for_each_entry(sas_device, &ioc->sas_device_list, list) { 494 if (sas_device->sas_address == sas_address)
501 if (sas_device->sas_address != sas_address) 495 return sas_device;
502 continue; 496
503 r = sas_device; 497 return NULL;
504 goto out;
505 }
506 out:
507 return r;
508} 498}
509 499
510/** 500/**
@@ -519,28 +509,17 @@ mpt2sas_scsih_sas_device_find_by_sas_address(struct MPT2SAS_ADAPTER *ioc,
519static struct _sas_device * 509static struct _sas_device *
520_scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle) 510_scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
521{ 511{
522 struct _sas_device *sas_device, *r; 512 struct _sas_device *sas_device;
523 513
524 r = NULL; 514 list_for_each_entry(sas_device, &ioc->sas_device_list, list)
525 if (ioc->wait_for_port_enable_to_complete) { 515 if (sas_device->handle == handle)
526 list_for_each_entry(sas_device, &ioc->sas_device_init_list, 516 return sas_device;
527 list) {
528 if (sas_device->handle != handle)
529 continue;
530 r = sas_device;
531 goto out;
532 }
533 } else {
534 list_for_each_entry(sas_device, &ioc->sas_device_list, list) {
535 if (sas_device->handle != handle)
536 continue;
537 r = sas_device;
538 goto out;
539 }
540 }
541 517
542 out: 518 list_for_each_entry(sas_device, &ioc->sas_device_init_list, list)
543 return r; 519 if (sas_device->handle == handle)
520 return sas_device;
521
522 return NULL;
544} 523}
545 524
546/** 525/**