drivers/scsi/arm/queue.c

Source file repositories/reference/linux-study-clean/drivers/scsi/arm/queue.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/arm/queue.c
Extension
.c
Size
8098 bytes
Lines
320
Domain
Driver Families
Bucket
drivers/scsi
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

scsi_cmd_to_rq(q->SCpnt)->tag == tag) {
			SCpnt = __queue_remove(queue, l);
			break;
		}
	}
	spin_unlock_irqrestore(&queue->queue_lock, flags);

	return SCpnt;
}

/*
 * Function: queue_remove_all_target(queue, target)
 * Purpose : remove all SCSI commands from the queue for a specified target
 * Params  : queue  - queue to remove command from
 *           target - target device id
 * Returns : nothing
 */
void queue_remove_all_target(Queue_t *queue, int target)
{
	unsigned long flags;
	struct list_head *l;

	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)
			__queue_remove(queue, l);
	}
	spin_unlock_irqrestore(&queue->queue_lock, flags);
}

/*
 * Function: int queue_probetgtlun (queue, target, lun)
 * Purpose : check to see if we have a command in the queue for the specified
 *	     target/lun.
 * Params  : queue  - queue to look in
 *	     target - target we want to probe
 *	     lun    - lun on target
 * Returns : 0 if not found, != 0 if found
 */
int queue_probetgtlun (Queue_t *queue, int target, int lun)
{
	unsigned long flags;
	struct list_head *l;
	int found = 0;

	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) {
			found = 1;
			break;
		}
	}
	spin_unlock_irqrestore(&queue->queue_lock, flags);

	return found;
}

/*
 * Function: int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt)
 * Purpose : remove a specific command from the queues
 * Params  : queue - queue to look in
 *	     SCpnt - command to find
 * Returns : 0 if not found
 */
int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt)
{
	unsigned long flags;
	struct list_head *l;
	int found = 0;

	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 == SCpnt) {
			__queue_remove(queue, l);
			found = 1;
			break;
		}
	}
	spin_unlock_irqrestore(&queue->queue_lock, flags);

	return found;
}

EXPORT_SYMBOL(queue_initialise);
EXPORT_SYMBOL(queue_free);
EXPORT_SYMBOL(__queue_add);
EXPORT_SYMBOL(queue_remove);

Annotation

Implementation Notes