/* This searches for sas_device based on sas_address, then return sas_device object.  */
static struct _sas_device* _scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
/* This searches for sas_device based on sas_address, then return sas_device object.  */
static struct _sas_device* _scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
{
	struct _sas_device *sas_device, *r;
	r = NULL;
	if (ioc->wait_for_port_enable_to_complete) {
		list_for_each_entry(sas_device, &ioc->sas_device_init_list,
		    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:
	return r;
}