/* Allocate a SCB structure. This is the central structure for controller commands.  */
static scb_t* mega_allocate_scb(adapter_t *adapter, Scsi_Cmnd *cmd)
/* Allocate a SCB structure. This is the central structure for controller commands.  */
static scb_t* mega_allocate_scb(adapter_t *adapter, Scsi_Cmnd *cmd)
{
	struct list_head *head = &adapter->free_list;
	scb_t	*scb;
	if( !list_empty(head) ) {
		scb = list_entry(head->next, scb_t, list);
		list_del_init(head->next);
		scb->state = SCB_ACTIVE;
		scb->cmd = cmd;
		scb->dma_type = MEGA_DMA_TYPE_NONE;
		return scb;
	}
	return NULL;
}