Commit da4afffc authored by Ralf Baechle's avatar Ralf Baechle

MIPS: Alchemy: Simplify DMA channel allocation code.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Cc: Manuel Lauss <manuel.lauss@googlemail.com>
parent 2bd00736
...@@ -237,7 +237,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, ...@@ -237,7 +237,7 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
void (*callback)(int, void *), void *callparam) void (*callback)(int, void *), void *callparam)
{ {
unsigned long flags; unsigned long flags;
u32 used, chan, rv; u32 used, chan;
u32 dcp; u32 dcp;
int i; int i;
dbdev_tab_t *stp, *dtp; dbdev_tab_t *stp, *dtp;
...@@ -260,7 +260,6 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, ...@@ -260,7 +260,6 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
return 0; return 0;
used = 0; used = 0;
rv = 0;
/* Check to see if we can get both channels. */ /* Check to see if we can get both channels. */
spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags); spin_lock_irqsave(&au1xxx_dbdma_spin_lock, flags);
...@@ -281,7 +280,9 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, ...@@ -281,7 +280,9 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
used++; used++;
spin_unlock_irqrestore(&au1xxx_dbdma_spin_lock, flags); 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. */ /* Let's see if we can allocate a channel for it. */
ctp = NULL; ctp = NULL;
chan = 0; chan = 0;
...@@ -326,18 +327,18 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid, ...@@ -326,18 +327,18 @@ u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
cp->ddma_cfg = i; cp->ddma_cfg = i;
au_sync(); au_sync();
/* Return a non-zero value that can be used to /*
* find the channel information in subsequent * Return a non-zero value that can be used to find the channel
* operations. * information in subsequent operations.
*/ */
rv = (u32)(&chan_tab_ptr[chan]); return (u32)(&chan_tab_ptr[chan]);
} else { }
/* Release devices */ /* Release devices */
stp->dev_flags &= ~DEV_FLAGS_INUSE; stp->dev_flags &= ~DEV_FLAGS_INUSE;
dtp->dev_flags &= ~DEV_FLAGS_INUSE; dtp->dev_flags &= ~DEV_FLAGS_INUSE;
}
} return 0;
return rv;
} }
EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc); EXPORT_SYMBOL(au1xxx_dbdma_chan_alloc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment