[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>
This commit is contained in:
committed by
James Bottomley
parent
f1c35e6aea
commit
cd9843f8af
@@ -484,27 +484,17 @@ struct _sas_device *
|
|||||||
mpt2sas_scsih_sas_device_find_by_sas_address(struct MPT2SAS_ADAPTER *ioc,
|
mpt2sas_scsih_sas_device_find_by_sas_address(struct MPT2SAS_ADAPTER *ioc,
|
||||||
u64 sas_address)
|
u64 sas_address)
|
||||||
{
|
{
|
||||||
struct _sas_device *sas_device, *r;
|
struct _sas_device *sas_device;
|
||||||
|
|
||||||
r = NULL;
|
list_for_each_entry(sas_device, &ioc->sas_device_list, list)
|
||||||
/* check the sas_device_init_list */
|
if (sas_device->sas_address == sas_address)
|
||||||
list_for_each_entry(sas_device, &ioc->sas_device_init_list,
|
return sas_device;
|
||||||
list) {
|
|
||||||
if (sas_device->sas_address != sas_address)
|
|
||||||
continue;
|
|
||||||
r = sas_device;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* then check the sas_device_list */
|
list_for_each_entry(sas_device, &ioc->sas_device_init_list, list)
|
||||||
list_for_each_entry(sas_device, &ioc->sas_device_list, list) {
|
if (sas_device->sas_address == sas_address)
|
||||||
if (sas_device->sas_address != sas_address)
|
return sas_device;
|
||||||
continue;
|
|
||||||
r = sas_device;
|
return NULL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
out:
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -519,28 +509,17 @@ mpt2sas_scsih_sas_device_find_by_sas_address(struct MPT2SAS_ADAPTER *ioc,
|
|||||||
static struct _sas_device *
|
static struct _sas_device *
|
||||||
_scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
|
_scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
|
||||||
{
|
{
|
||||||
struct _sas_device *sas_device, *r;
|
struct _sas_device *sas_device;
|
||||||
|
|
||||||
r = NULL;
|
list_for_each_entry(sas_device, &ioc->sas_device_list, list)
|
||||||
if (ioc->wait_for_port_enable_to_complete) {
|
if (sas_device->handle == handle)
|
||||||
list_for_each_entry(sas_device, &ioc->sas_device_init_list,
|
return sas_device;
|
||||||
list) {
|
|
||||||
if (sas_device->handle != handle)
|
|
||||||
continue;
|
|
||||||
r = sas_device;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
list_for_each_entry(sas_device, &ioc->sas_device_list, list) {
|
|
||||||
if (sas_device->handle != handle)
|
|
||||||
continue;
|
|
||||||
r = sas_device;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
list_for_each_entry(sas_device, &ioc->sas_device_init_list, list)
|
||||||
return r;
|
if (sas_device->handle == handle)
|
||||||
|
return sas_device;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user