/* Note: The only reason why drivers should use this is because they need to access the device list in irq context. Otherwise you really want to use scsi_device_lookup_by_target instead.  */
struct scsi_device* __scsi_device_lookup_by_target(struct scsi_target *starget, uint lun)
/* Note: The only reason why drivers should use this is because they need to access the device list in irq context. Otherwise you really want to use scsi_device_lookup_by_target instead.  */
struct scsi_device* __scsi_device_lookup_by_target(struct scsi_target *starget, uint lun)
{
	struct scsi_device *sdev;
	list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
		if (sdev->sdev_state == SDEV_DEL)
			continue;
		if (sdev->lun ==lun)
			return sdev;
	}
	return NULL;
}