aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-03-09 06:02:17 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-04-11 10:23:28 -0400
commitcd9843f8afb9dbdee101d1d7d9717e361c7c9b3a (patch)
tree78b6f5d7945e2a6250f6085fe41243c389865805
parentf1c35e6aea579d5bdb6dc02dfa99c67c7c3b3f67 (diff)
[SCSI] mpt2sas: modified _scsih_sas_device_find_by_handle/sas_address
modified _scsih_sas_device_find_by_handle so to handle the search on both list(device list and device_init_list) Also, we moved the priority of the search so the ioc->sas_device_list is done first. The "sas_device_init_list" is only used during the 1st port enable, so its unlikely there’s devices on it. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Reviewed-by: Eric Moore <eric.moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-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/**