aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2008-10-28 06:19:29 -0400
committerBryan Wu <cooloney@kernel.org>2008-10-28 06:19:29 -0400
commita2ba8b19989e038bdf1a9fcc25e860d5077d2474 (patch)
treed5d72bd510897bb54d40e336d0ef38be256d11ce /arch/blackfin
parent3529e0414b600faa1b6d822569b3343131235813 (diff)
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: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/include/asm/dma.h1
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c24
2 files changed, 7 insertions, 18 deletions
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
index 6509733bb0f6..9befcbae00b9 100644
--- a/arch/blackfin/include/asm/dma.h
+++ b/arch/blackfin/include/asm/dma.h
@@ -140,6 +140,7 @@ struct dma_channel {
140 struct dma_register *regs; 140 struct dma_register *regs;
141 struct dmasg *sg; /* large mode descriptor */ 141 struct dmasg *sg; /* large mode descriptor */
142 unsigned int ctrl_num; /* controller number */ 142 unsigned int ctrl_num; /* controller number */
143 unsigned int irq;
143 dma_interrupt_t irq_callback; 144 dma_interrupt_t irq_callback;
144 void *data; 145 void *data;
145 unsigned int dma_enable_flag; 146 unsigned int dma_enable_flag;
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index ca3a26a78893..add58d219361 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -139,19 +139,16 @@ EXPORT_SYMBOL(request_dma);
139 139
140int set_dma_callback(unsigned int channel, dma_interrupt_t callback, void *data) 140int set_dma_callback(unsigned int channel, dma_interrupt_t callback, void *data)
141{ 141{
142 int ret_irq = 0;
143
144 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE 142 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
145 && channel < MAX_BLACKFIN_DMA_CHANNEL)); 143 && channel < MAX_BLACKFIN_DMA_CHANNEL));
146 144
147 if (callback != NULL) { 145 if (callback != NULL) {
148 int ret_val; 146 int ret_val;
149 ret_irq = channel2irq(channel); 147 dma_ch[channel].irq = channel2irq(channel);
150
151 dma_ch[channel].data = data; 148 dma_ch[channel].data = data;
152 149
153 ret_val = 150 ret_val =
154 request_irq(ret_irq, (void *)callback, IRQF_DISABLED, 151 request_irq(dma_ch[channel].irq, callback, IRQF_DISABLED,
155 dma_ch[channel].device_id, data); 152 dma_ch[channel].device_id, data);
156 if (ret_val) { 153 if (ret_val) {
157 printk(KERN_NOTICE 154 printk(KERN_NOTICE
@@ -166,7 +163,6 @@ EXPORT_SYMBOL(set_dma_callback);
166 163
167void free_dma(unsigned int channel) 164void free_dma(unsigned int channel)
168{ 165{
169 int ret_irq;
170 166
171 pr_debug("freedma() : BEGIN \n"); 167 pr_debug("freedma() : BEGIN \n");
172 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE 168 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
@@ -176,10 +172,8 @@ void free_dma(unsigned int channel)
176 disable_dma(channel); 172 disable_dma(channel);
177 clear_dma_buffer(channel); 173 clear_dma_buffer(channel);
178 174
179 if (dma_ch[channel].irq_callback != NULL) { 175 if (dma_ch[channel].irq_callback != NULL)
180 ret_irq = channel2irq(channel); 176 free_irq(dma_ch[channel].irq, dma_ch[channel].data);
181 free_irq(ret_irq, dma_ch[channel].data);
182 }
183 177
184 /* Clear the DMA Variable in the Channel */ 178 /* Clear the DMA Variable in the Channel */
185 mutex_lock(&(dma_ch[channel].dmalock)); 179 mutex_lock(&(dma_ch[channel].dmalock));
@@ -192,27 +186,21 @@ EXPORT_SYMBOL(free_dma);
192 186
193void dma_enable_irq(unsigned int channel) 187void dma_enable_irq(unsigned int channel)
194{ 188{
195 int ret_irq;
196
197 pr_debug("dma_enable_irq() : BEGIN \n"); 189 pr_debug("dma_enable_irq() : BEGIN \n");
198 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE 190 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
199 && channel < MAX_BLACKFIN_DMA_CHANNEL)); 191 && channel < MAX_BLACKFIN_DMA_CHANNEL));
200 192
201 ret_irq = channel2irq(channel); 193 enable_irq(dma_ch[channel].irq);
202 enable_irq(ret_irq);
203} 194}
204EXPORT_SYMBOL(dma_enable_irq); 195EXPORT_SYMBOL(dma_enable_irq);
205 196
206void dma_disable_irq(unsigned int channel) 197void dma_disable_irq(unsigned int channel)
207{ 198{
208 int ret_irq;
209
210 pr_debug("dma_disable_irq() : BEGIN \n"); 199 pr_debug("dma_disable_irq() : BEGIN \n");
211 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE 200 BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
212 && channel < MAX_BLACKFIN_DMA_CHANNEL)); 201 && channel < MAX_BLACKFIN_DMA_CHANNEL));
213 202
214 ret_irq = channel2irq(channel); 203 disable_irq(dma_ch[channel].irq);
215 disable_irq(ret_irq);
216} 204}
217EXPORT_SYMBOL(dma_disable_irq); 205EXPORT_SYMBOL(dma_disable_irq);
218 206