/* Lock the command queue and return pointer to space for len cmd words It locks the cmdlock spinlock.  */
static s32* dbri_cmdlock(struct snd_dbri *dbri, int len)
/* Lock the command queue and return pointer to space for len cmd words It locks the cmdlock spinlock.  */
static s32* dbri_cmdlock(struct snd_dbri *dbri, int len)
{
	len += 2;
	spin_lock(&dbri->cmdlock);
	if (dbri->cmdptr - dbri->dma->cmd + len < DBRI_NO_CMDS - 2)
		return dbri->cmdptr + 2;
	else if (len < sbus_readl(dbri->regs + REG8) - dbri->dma_dvma)
		return dbri->dma->cmd;
	else
		printk(KERN_ERR "DBRI: no space for commands.");
	return NULL;
}