aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/drivers/dma/dma-sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/drivers/dma/dma-sh.c')
-rw-r--r--arch/sh/drivers/dma/dma-sh.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index e028a2d2a4ea..cbbe8bce3d67 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -11,14 +11,10 @@
11 * License. See the file "COPYING" in the main directory of this archive 11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details. 12 * for more details.
13 */ 13 */
14
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/interrupt.h> 15#include <linux/interrupt.h>
18#include <linux/module.h> 16#include <linux/module.h>
19#include <asm/dreamcast/dma.h> 17#include <asm/dreamcast/dma.h>
20#include <asm/signal.h>
21#include <asm/irq.h>
22#include <asm/dma.h> 18#include <asm/dma.h>
23#include <asm/io.h> 19#include <asm/io.h>
24#include "dma-sh.h" 20#include "dma-sh.h"
@@ -84,18 +80,23 @@ static irqreturn_t dma_tei(int irq, void *dev_id, struct pt_regs *regs)
84 80
85static int sh_dmac_request_dma(struct dma_channel *chan) 81static int sh_dmac_request_dma(struct dma_channel *chan)
86{ 82{
87 char name[32]; 83 if (unlikely(!chan->flags & DMA_TEI_CAPABLE))
84 return 0;
88 85
89 snprintf(name, sizeof(name), "DMAC Transfer End (Channel %d)", 86 chan->name = kzalloc(32, GFP_KERNEL);
87 if (unlikely(chan->name == NULL))
88 return -ENOMEM;
89 snprintf(chan->name, 32, "DMAC Transfer End (Channel %d)",
90 chan->chan); 90 chan->chan);
91 91
92 return request_irq(get_dmte_irq(chan->chan), dma_tei, 92 return request_irq(get_dmte_irq(chan->chan), dma_tei,
93 IRQF_DISABLED, name, chan); 93 IRQF_DISABLED, chan->name, chan);
94} 94}
95 95
96static void sh_dmac_free_dma(struct dma_channel *chan) 96static void sh_dmac_free_dma(struct dma_channel *chan)
97{ 97{
98 free_irq(get_dmte_irq(chan->chan), chan); 98 free_irq(get_dmte_irq(chan->chan), chan);
99 kfree(chan->name);
99} 100}
100 101
101static void 102static void
@@ -259,7 +260,7 @@ static int __init sh_dmac_init(void)
259#ifdef CONFIG_CPU_SH4 260#ifdef CONFIG_CPU_SH4
260 make_ipr_irq(DMAE_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); 261 make_ipr_irq(DMAE_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY);
261 i = request_irq(DMAE_IRQ, dma_err, IRQF_DISABLED, "DMAC Address Error", 0); 262 i = request_irq(DMAE_IRQ, dma_err, IRQF_DISABLED, "DMAC Address Error", 0);
262 if (i < 0) 263 if (unlikely(i < 0))
263 return i; 264 return i;
264#endif 265#endif
265 266
@@ -274,7 +275,7 @@ static int __init sh_dmac_init(void)
274 * been set. 275 * been set.
275 */ 276 */
276 i = dmaor_reset(); 277 i = dmaor_reset();
277 if (i < 0) 278 if (unlikely(i != 0))
278 return i; 279 return i;
279 280
280 return register_dmac(info); 281 return register_dmac(info);