dect
/
linux-2.6
Archived
13
0
Fork 0

MIPS: Alchemy: Simplify DMA channel allocation code.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Manuel Lauss <manuel.lauss@googlemail.com>
This commit is contained in:
Ralf Baechle 2010-02-27 12:53:37 +01:00
parent 2bd0073656
commit da4afffc1d
1 changed files with 56 additions and 55 deletions

View File

@ -237,7 +237,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
void (*callback)(int, void *), void *callparam)
{
unsigned long flags;
u32 used, chan, rv;
u32 used, chan;
u32 dcp;
int i;
dbdev_tab_t *stp, *dtp;
@ -260,7 +260,6 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
return 0;
used = 0;
rv = 0;
/* Check to see if we can get both channels. */
spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
@ -281,7 +280,9 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
used++;
spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags);
if (!used) {
if (used)
return 0;
/* Let's see if we can allocate a channel for it. */
ctp = NULL;
chan = 0;
@ -326,18 +327,18 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
cp->ddma_cfg = i;
au_sync();
/* Return a non-zero value that can be used to
* find the channel information in subsequent
* operations.
/*
* Return a non-zero value that can be used to find the channel
* information in subsequent operations.
*/
rv = (u32)(&chan_tab_ptr[chan]);
} else {
return (u32)(&chan_tab_ptr[chan]);
}
/* Release devices */
stp->dev_flags &= ~DEV_FLAGS_INUSE;
dtp->dev_flags &= ~DEV_FLAGS_INUSE;
}
}
return rv;
return 0;
}
EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc);