/* Function: struct scsi_cmnd *queue_remove_tgtluntag (queue, target, lun, tag) Purpose : remove a SCSI command from the queue for a specified target/lun/tag Params : queue - queue to remove command from target - target that we want lun - lun on device tag - tag on device Returns : struct scsi_cmnd if successful, or NULL if no command satisfies requirements  */
struct scsi_cmnd* queue_remove_tgtluntag(Queue_t *queue, int target, int lun, int tag)
/* Function: struct scsi_cmnd *queue_remove_tgtluntag (queue, target, lun, tag) Purpose : remove a SCSI command from the queue for a specified target/lun/tag Params : queue - queue to remove command from target - target that we want lun - lun on device tag - tag on device Returns : struct scsi_cmnd if successful, or NULL if no command satisfies requirements  */
struct scsi_cmnd* queue_remove_tgtluntag(Queue_t *queue, int target, int lun, int tag)
{
	unsigned long flags;
	struct list_head *l;
	struct scsi_cmnd *SCpnt = NULL;
	spin_lock_irqsave(&queue->queue_lock, flags);
	list_for_each(l, &queue->head) {
		QE_t *q = list_entry(l, QE_t, list);
		if (q->SCpnt->device->id == target && q->SCpnt->device->lun == lun &&
		    q->SCpnt->tag == tag) {
			SCpnt = __queue_remove(queue, l);
			break;
		}
	}
	spin_unlock_irqrestore(&queue->queue_lock, flags);
	return SCpnt;
}