/* Return Value: returns pointer to cmd block or NULL if no blocks are available  */
static struct pmcraid_cmd* pmcraid_get_free_cmd(struct pmcraid_instance *pinstance)
/* Return Value: returns pointer to cmd block or NULL if no blocks are available  */
static struct pmcraid_cmd* pmcraid_get_free_cmd(struct pmcraid_instance *pinstance)
{
	struct pmcraid_cmd *cmd = NULL;
	unsigned long lock_flags;
	spin_lock_irqsave(&pinstance->free_pool_lock, lock_flags);
	if (!list_empty(&pinstance->free_cmd_pool)) {
		cmd = list_entry(pinstance->free_cmd_pool.next,
				 struct pmcraid_cmd, free_list);
		list_del(&cmd->free_list);
	}
	spin_unlock_irqrestore(&pinstance->free_pool_lock, lock_flags);
	if (cmd != NULL)
		pmcraid_reinit_cmdblk(cmd);
	return cmd;
}