Blackfin arch: remove most BUG_ON channel checks
authorMichael Hennerich <michael.hennerich@analog.com>
Wed, 29 Oct 2008 03:06:03 +0000 (11:06 +0800)
committerBryan Wu <cooloney@kernel.org>
Wed, 29 Oct 2008 03:06:03 +0000 (11:06 +0800)
keep BUG_ON in DMA request, free and set_dma_callback.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
arch/blackfin/kernel/bfin_dma_5xx.c

index 35d51ac..a778bc8 100644 (file)
@@ -162,7 +162,6 @@ EXPORT_SYMBOL(set_dma_callback);
 
 void free_dma(unsigned int channel)
 {
-
        pr_debug("freedma() : BEGIN \n");
        BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
               && channel < MAX_BLACKFIN_DMA_CHANNEL));
@@ -186,9 +185,6 @@ EXPORT_SYMBOL(free_dma);
 void dma_enable_irq(unsigned int channel)
 {
        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);
 }
 EXPORT_SYMBOL(dma_enable_irq);
@@ -196,9 +192,6 @@ EXPORT_SYMBOL(dma_enable_irq);
 void dma_disable_irq(unsigned int channel)
 {
        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);
 }
 EXPORT_SYMBOL(dma_disable_irq);
@@ -219,10 +212,6 @@ EXPORT_SYMBOL(dma_channel_active);
 void disable_dma(unsigned int channel)
 {
        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 */
        SSYNC();
        dma_ch[channel].chan_status = DMA_CHANNEL_REQUESTED;
@@ -235,10 +224,6 @@ EXPORT_SYMBOL(disable_dma);
 void enable_dma(unsigned int channel)
 {
        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].regs->curr_x_count = 0;
        dma_ch[channel].regs->curr_y_count = 0;
@@ -258,10 +243,6 @@ EXPORT_SYMBOL(enable_dma);
 void set_dma_start_addr(unsigned int channel, unsigned long addr)
 {
        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;
        pr_debug("set_dma_start_addr() : END\n");
 }
@@ -270,10 +251,6 @@ EXPORT_SYMBOL(set_dma_start_addr);
 void set_dma_next_desc_addr(unsigned int channel, unsigned long addr)
 {
        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;
        pr_debug("set_dma_next_desc_addr() : END\n");
 }
@@ -282,10 +259,6 @@ EXPORT_SYMBOL(set_dma_next_desc_addr);
 void set_dma_curr_desc_addr(unsigned int channel, unsigned long addr)
 {
        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;
        pr_debug("set_dma_curr_desc_addr() : END\n");
 }
@@ -293,47 +266,31 @@ EXPORT_SYMBOL(set_dma_curr_desc_addr);
 
 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;
 }
 EXPORT_SYMBOL(set_dma_x_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;
 }
 EXPORT_SYMBOL(set_dma_y_count);
 
 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;
 }
 EXPORT_SYMBOL(set_dma_x_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;
 }
 EXPORT_SYMBOL(set_dma_y_modify);
 
 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;
-
 }
 EXPORT_SYMBOL(set_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)
 {
-       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->next_desc_ptr = (unsigned int)sg;
 }
 EXPORT_SYMBOL(set_dma_sg);
 
 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;
 }
 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)
 {
-       BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
-              && channel < MAX_BLACKFIN_DMA_CHANNEL));
-
        return dma_ch[channel].regs->irq_status;
 }
 EXPORT_SYMBOL(get_dma_curr_irqstat);
@@ -387,8 +334,6 @@ EXPORT_SYMBOL(get_dma_curr_irqstat);
  *-----------------------------------------------------------------------------*/
 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;
 }
 EXPORT_SYMBOL(clear_dma_irqstat);
@@ -398,9 +343,6 @@ EXPORT_SYMBOL(clear_dma_irqstat);
  *-----------------------------------------------------------------------------*/
 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;
 }
 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)
 {
-       BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
-              && channel < MAX_BLACKFIN_DMA_CHANNEL));
-
        return dma_ch[channel].regs->curr_y_count;
 }
 EXPORT_SYMBOL(get_dma_curr_ycount);
 
 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;
 }
 EXPORT_SYMBOL(get_dma_next_desc_ptr);
 
 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;
 }
 EXPORT_SYMBOL(get_dma_curr_desc_ptr);
 
 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;
 }
 EXPORT_SYMBOL(get_dma_curr_addr);