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

Blackfin arch: remove most BUG_ON channel checks

keep BUG_ON in DMA request, free and set_dma_callback.
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent 2cf85113
...@@ -162,7 +162,6 @@ EXPORT_SYMBOL(set_dma_callback); ...@@ -162,7 +162,6 @@ EXPORT_SYMBOL(set_dma_callback);
void free_dma(unsigned int channel) void free_dma(unsigned int channel)
{ {
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
&& channel < MAX_BLACKFIN_DMA_CHANNEL)); && channel < MAX_BLACKFIN_DMA_CHANNEL));
...@@ -186,9 +185,6 @@ EXPORT_SYMBOL(free_dma); ...@@ -186,9 +185,6 @@ EXPORT_SYMBOL(free_dma);
void dma_enable_irq(unsigned int channel) void dma_enable_irq(unsigned int channel)
{ {
pr_debug("dma_enable_irq() : BEGIN \n"); pr_debug("dma_enable_irq() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
enable_irq(dma_ch[channel].irq); enable_irq(dma_ch[channel].irq);
} }
EXPORT_SYMBOL(dma_enable_irq); EXPORT_SYMBOL(dma_enable_irq);
...@@ -196,9 +192,6 @@ EXPORT_SYMBOL(dma_enable_irq); ...@@ -196,9 +192,6 @@ EXPORT_SYMBOL(dma_enable_irq);
void dma_disable_irq(unsigned int channel) void dma_disable_irq(unsigned int channel)
{ {
pr_debug("dma_disable_irq() : BEGIN \n"); pr_debug("dma_disable_irq() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
disable_irq(dma_ch[channel].irq); disable_irq(dma_ch[channel].irq);
} }
EXPORT_SYMBOL(dma_disable_irq); EXPORT_SYMBOL(dma_disable_irq);
...@@ -219,10 +212,6 @@ EXPORT_SYMBOL(dma_channel_active); ...@@ -219,10 +212,6 @@ EXPORT_SYMBOL(dma_channel_active);
void disable_dma(unsigned int channel) void disable_dma(unsigned int channel)
{ {
pr_debug("stop_dma() : BEGIN \n"); pr_debug("stop_dma() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->cfg &= ~DMAEN; /* Clean the enable bit */ dma_ch[channel].regs->cfg &= ~DMAEN; /* Clean the enable bit */
SSYNC(); SSYNC();
dma_ch[channel].chan_status = DMA_CHANNEL_REQUESTED; dma_ch[channel].chan_status = DMA_CHANNEL_REQUESTED;
...@@ -235,10 +224,6 @@ EXPORT_SYMBOL(disable_dma); ...@@ -235,10 +224,6 @@ EXPORT_SYMBOL(disable_dma);
void enable_dma(unsigned int channel) void enable_dma(unsigned int channel)
{ {
pr_debug("enable_dma() : BEGIN \n"); pr_debug("enable_dma() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].chan_status = DMA_CHANNEL_ENABLED; dma_ch[channel].chan_status = DMA_CHANNEL_ENABLED;
dma_ch[channel].regs->curr_x_count = 0; dma_ch[channel].regs->curr_x_count = 0;
dma_ch[channel].regs->curr_y_count = 0; dma_ch[channel].regs->curr_y_count = 0;
...@@ -258,10 +243,6 @@ EXPORT_SYMBOL(enable_dma); ...@@ -258,10 +243,6 @@ EXPORT_SYMBOL(enable_dma);
void set_dma_start_addr(unsigned int channel, unsigned long addr) void set_dma_start_addr(unsigned int channel, unsigned long addr)
{ {
pr_debug("set_dma_start_addr() : BEGIN \n"); pr_debug("set_dma_start_addr() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->start_addr = addr; dma_ch[channel].regs->start_addr = addr;
pr_debug("set_dma_start_addr() : END\n"); pr_debug("set_dma_start_addr() : END\n");
} }
...@@ -270,10 +251,6 @@ EXPORT_SYMBOL(set_dma_start_addr); ...@@ -270,10 +251,6 @@ EXPORT_SYMBOL(set_dma_start_addr);
void set_dma_next_desc_addr(unsigned int channel, unsigned long addr) void set_dma_next_desc_addr(unsigned int channel, unsigned long addr)
{ {
pr_debug("set_dma_next_desc_addr() : BEGIN \n"); pr_debug("set_dma_next_desc_addr() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->next_desc_ptr = addr; dma_ch[channel].regs->next_desc_ptr = addr;
pr_debug("set_dma_next_desc_addr() : END\n"); pr_debug("set_dma_next_desc_addr() : END\n");
} }
...@@ -282,10 +259,6 @@ EXPORT_SYMBOL(set_dma_next_desc_addr); ...@@ -282,10 +259,6 @@ EXPORT_SYMBOL(set_dma_next_desc_addr);
void set_dma_curr_desc_addr(unsigned int channel, unsigned long addr) void set_dma_curr_desc_addr(unsigned int channel, unsigned long addr)
{ {
pr_debug("set_dma_curr_desc_addr() : BEGIN \n"); pr_debug("set_dma_curr_desc_addr() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->curr_desc_ptr = addr; dma_ch[channel].regs->curr_desc_ptr = addr;
pr_debug("set_dma_curr_desc_addr() : END\n"); pr_debug("set_dma_curr_desc_addr() : END\n");
} }
...@@ -293,47 +266,31 @@ EXPORT_SYMBOL(set_dma_curr_desc_addr); ...@@ -293,47 +266,31 @@ EXPORT_SYMBOL(set_dma_curr_desc_addr);
void set_dma_x_count(unsigned int channel, unsigned short x_count) void set_dma_x_count(unsigned int channel, unsigned short x_count)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->x_count = x_count; dma_ch[channel].regs->x_count = x_count;
} }
EXPORT_SYMBOL(set_dma_x_count); EXPORT_SYMBOL(set_dma_x_count);
void set_dma_y_count(unsigned int channel, unsigned short y_count) void set_dma_y_count(unsigned int channel, unsigned short y_count)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->y_count = y_count; dma_ch[channel].regs->y_count = y_count;
} }
EXPORT_SYMBOL(set_dma_y_count); EXPORT_SYMBOL(set_dma_y_count);
void set_dma_x_modify(unsigned int channel, short x_modify) void set_dma_x_modify(unsigned int channel, short x_modify)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->x_modify = x_modify; dma_ch[channel].regs->x_modify = x_modify;
} }
EXPORT_SYMBOL(set_dma_x_modify); EXPORT_SYMBOL(set_dma_x_modify);
void set_dma_y_modify(unsigned int channel, short y_modify) void set_dma_y_modify(unsigned int channel, short y_modify)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->y_modify = y_modify; dma_ch[channel].regs->y_modify = y_modify;
} }
EXPORT_SYMBOL(set_dma_y_modify); EXPORT_SYMBOL(set_dma_y_modify);
void set_dma_config(unsigned int channel, unsigned short config) void set_dma_config(unsigned int channel, unsigned short config)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->cfg = config; dma_ch[channel].regs->cfg = config;
} }
EXPORT_SYMBOL(set_dma_config); EXPORT_SYMBOL(set_dma_config);
...@@ -352,20 +309,13 @@ EXPORT_SYMBOL(set_bfin_dma_config); ...@@ -352,20 +309,13 @@ EXPORT_SYMBOL(set_bfin_dma_config);
void set_dma_sg(unsigned int channel, struct dmasg *sg, int nr_sg) void set_dma_sg(unsigned int channel, struct dmasg *sg, int nr_sg)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->cfg |= ((nr_sg & 0x0F) << 8); dma_ch[channel].regs->cfg |= ((nr_sg & 0x0F) << 8);
dma_ch[channel].regs->next_desc_ptr = (unsigned int)sg; dma_ch[channel].regs->next_desc_ptr = (unsigned int)sg;
} }
EXPORT_SYMBOL(set_dma_sg); EXPORT_SYMBOL(set_dma_sg);
void set_dma_curr_addr(unsigned int channel, unsigned long addr) void set_dma_curr_addr(unsigned int channel, unsigned long addr)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->curr_addr_ptr = addr; dma_ch[channel].regs->curr_addr_ptr = addr;
} }
EXPORT_SYMBOL(set_dma_curr_addr); EXPORT_SYMBOL(set_dma_curr_addr);
...@@ -375,9 +325,6 @@ EXPORT_SYMBOL(set_dma_curr_addr); ...@@ -375,9 +325,6 @@ EXPORT_SYMBOL(set_dma_curr_addr);
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
unsigned short get_dma_curr_irqstat(unsigned int channel) unsigned short get_dma_curr_irqstat(unsigned int channel)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
return dma_ch[channel].regs->irq_status; return dma_ch[channel].regs->irq_status;
} }
EXPORT_SYMBOL(get_dma_curr_irqstat); EXPORT_SYMBOL(get_dma_curr_irqstat);
...@@ -387,8 +334,6 @@ EXPORT_SYMBOL(get_dma_curr_irqstat); ...@@ -387,8 +334,6 @@ EXPORT_SYMBOL(get_dma_curr_irqstat);
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
void clear_dma_irqstat(unsigned int channel) void clear_dma_irqstat(unsigned int channel)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
dma_ch[channel].regs->irq_status |= 3; dma_ch[channel].regs->irq_status |= 3;
} }
EXPORT_SYMBOL(clear_dma_irqstat); EXPORT_SYMBOL(clear_dma_irqstat);
...@@ -398,9 +343,6 @@ EXPORT_SYMBOL(clear_dma_irqstat); ...@@ -398,9 +343,6 @@ EXPORT_SYMBOL(clear_dma_irqstat);
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
unsigned short get_dma_curr_xcount(unsigned int channel) unsigned short get_dma_curr_xcount(unsigned int channel)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
return dma_ch[channel].regs->curr_x_count; return dma_ch[channel].regs->curr_x_count;
} }
EXPORT_SYMBOL(get_dma_curr_xcount); EXPORT_SYMBOL(get_dma_curr_xcount);
...@@ -410,36 +352,24 @@ EXPORT_SYMBOL(get_dma_curr_xcount); ...@@ -410,36 +352,24 @@ EXPORT_SYMBOL(get_dma_curr_xcount);
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
unsigned short get_dma_curr_ycount(unsigned int channel) unsigned short get_dma_curr_ycount(unsigned int channel)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
return dma_ch[channel].regs->curr_y_count; return dma_ch[channel].regs->curr_y_count;
} }
EXPORT_SYMBOL(get_dma_curr_ycount); EXPORT_SYMBOL(get_dma_curr_ycount);
unsigned long get_dma_next_desc_ptr(unsigned int channel) unsigned long get_dma_next_desc_ptr(unsigned int channel)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
return dma_ch[channel].regs->next_desc_ptr; return dma_ch[channel].regs->next_desc_ptr;
} }
EXPORT_SYMBOL(get_dma_next_desc_ptr); EXPORT_SYMBOL(get_dma_next_desc_ptr);
unsigned long get_dma_curr_desc_ptr(unsigned int channel) unsigned long get_dma_curr_desc_ptr(unsigned int channel)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
return dma_ch[channel].regs->curr_desc_ptr; return dma_ch[channel].regs->curr_desc_ptr;
} }
EXPORT_SYMBOL(get_dma_curr_desc_ptr); EXPORT_SYMBOL(get_dma_curr_desc_ptr);
unsigned long get_dma_curr_addr(unsigned int channel) unsigned long get_dma_curr_addr(unsigned int channel)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_BLACKFIN_DMA_CHANNEL));
return dma_ch[channel].regs->curr_addr_ptr; return dma_ch[channel].regs->curr_addr_ptr;
} }
EXPORT_SYMBOL(get_dma_curr_addr); EXPORT_SYMBOL(get_dma_curr_addr);
......
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