/* Function: void queue_initialise (Queue_t *queue) Purpose : initialise a queue Params : queue - queue to initialise  */
int queue_initialise(Queue_t *queue)
/* Function: void queue_initialise (Queue_t *queue) Purpose : initialise a queue Params : queue - queue to initialise  */
int queue_initialise(Queue_t *queue)
{
	unsigned int nqueues = NR_QE;
	QE_t *q;
	spin_lock_init(&queue->queue_lock);
	INIT_LIST_HEAD(&queue->head);
	INIT_LIST_HEAD(&queue->free);
	queue->alloc = q = kmalloc(sizeof(QE_t) * nqueues, GFP_KERNEL);
	if (q) {
		for (; nqueues; q++, nqueues--) {
			SET_MAGIC(q, QUEUE_MAGIC_FREE);
			q->SCpnt = NULL;
			list_add(&q->list, &queue->free);
		}
	}
	return queue->alloc != NULL;
}