/* Return the scb from the head of the free list. NULL if there are none available.  */
static scb_t* megaraid_alloc_scb(adapter_t *adapter, struct scsi_cmnd *scp)
/* Return the scb from the head of the free list. NULL if there are none available.  */
static scb_t* megaraid_alloc_scb(adapter_t *adapter, struct scsi_cmnd *scp)
{
	struct list_head	*head = &adapter->kscb_pool;
	scb_t			*scb = NULL;
	unsigned long		flags;
	spin_lock_irqsave(SCSI_FREE_LIST_LOCK(adapter), flags);
	if (list_empty(head)) {
		spin_unlock_irqrestore(SCSI_FREE_LIST_LOCK(adapter), flags);
		return NULL;
	}
	scb = list_entry(head->next, scb_t, list);
	list_del_init(&scb->list);
	spin_unlock_irqrestore(SCSI_FREE_LIST_LOCK(adapter), flags);
	scb->state	= SCB_ACTIVE;
	scb->scp	= scp;
	scb->dma_type	= MRAID_DMA_NONE;
	return scb;
}