Commit a2ba8b19 authored by Michael Hennerich's avatar Michael Hennerich Committed by Bryan Wu

Blackfin arch: lookup channel2irq() only once

Add irq to struct dma_channel lookup channel2irq() only once,
since channel2irq() is fairly large on some Blackfin derivatives.
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent 3529e041
...@@ -140,6 +140,7 @@ struct dma_channel { ...@@ -140,6 +140,7 @@ struct dma_channel {
struct dma_register *regs; struct dma_register *regs;
struct dmasg *sg; /* large mode descriptor */ struct dmasg *sg; /* large mode descriptor */
unsigned int ctrl_num; /* controller number */ unsigned int ctrl_num; /* controller number */
unsigned int irq;
dma_interrupt_t irq_callback; dma_interrupt_t irq_callback;
void *data; void *data;
unsigned int dma_enable_flag; unsigned int dma_enable_flag;
......
...@@ -139,19 +139,16 @@ EXPORT_SYMBOL(request_dma); ...@@ -139,19 +139,16 @@ EXPORT_SYMBOL(request_dma);
int set_dma_callback(unsigned int channel, dma_interrupt_t callback, void *data) int set_dma_callback(unsigned int channel, dma_interrupt_t callback, void *data)
{ {
int ret_irq = 0;
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL)); && channel < MAX_BLACKFIN_DMA_CHANNEL));
if (callback != NULL) { if (callback != NULL) {
int ret_val; int ret_val;
ret_irq = channel2irq(channel); dma_ch[channel].irq = channel2irq(channel);
dma_ch[channel].data = data; dma_ch[channel].data = data;
ret_val = ret_val =
request_irq(ret_irq, (void *)callback, IRQF_DISABLED, request_irq(dma_ch[channel].irq, callback, IRQF_DISABLED,
dma_ch[channel].device_id, data); dma_ch[channel].device_id, data);
if (ret_val) { if (ret_val) {
printk(KERN_NOTICE printk(KERN_NOTICE
...@@ -166,7 +163,6 @@ EXPORT_SYMBOL(set_dma_callback); ...@@ -166,7 +163,6 @@ EXPORT_SYMBOL(set_dma_callback);
void free_dma(unsigned int channel) void free_dma(unsigned int channel)
{ {
int ret_irq;
pr_debug("freedma() : BEGIN \n"); pr_debug("freedma() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
...@@ -176,10 +172,8 @@ void free_dma(unsigned int channel) ...@@ -176,10 +172,8 @@ void free_dma(unsigned int channel)
disable_dma(channel); disable_dma(channel);
clear_dma_buffer(channel); clear_dma_buffer(channel);
if (dma_ch[channel].irq_callback != NULL) { if (dma_ch[channel].irq_callback != NULL)
ret_irq = channel2irq(channel); free_irq(dma_ch[channel].irq, dma_ch[channel].data);
free_irq(ret_irq, dma_ch[channel].data);
}
/* Clear the DMA Variable in the Channel */ /* Clear the DMA Variable in the Channel */
mutex_lock(&(dma_ch[channel].dmalock)); mutex_lock(&(dma_ch[channel].dmalock));
...@@ -192,27 +186,21 @@ EXPORT_SYMBOL(free_dma); ...@@ -192,27 +186,21 @@ EXPORT_SYMBOL(free_dma);
void dma_enable_irq(unsigned int channel) void dma_enable_irq(unsigned int channel)
{ {
int ret_irq;
pr_debug("dma_enable_irq() : BEGIN \n"); pr_debug("dma_enable_irq() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL)); && channel < MAX_BLACKFIN_DMA_CHANNEL));
ret_irq = channel2irq(channel); enable_irq(dma_ch[channel].irq);
enable_irq(ret_irq);
} }
EXPORT_SYMBOL(dma_enable_irq); EXPORT_SYMBOL(dma_enable_irq);
void dma_disable_irq(unsigned int channel) void dma_disable_irq(unsigned int channel)
{ {
int ret_irq;
pr_debug("dma_disable_irq() : BEGIN \n"); pr_debug("dma_disable_irq() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL)); && channel < MAX_BLACKFIN_DMA_CHANNEL));
ret_irq = channel2irq(channel); disable_irq(dma_ch[channel].irq);
disable_irq(ret_irq);
} }
EXPORT_SYMBOL(dma_disable_irq); EXPORT_SYMBOL(dma_disable_irq);
......
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