On Wed, 2015-07-08 at 12:34 +0300, Andy Shevchenko wrote: > All hardware accesses are done under virtual channel lock. That's why > specific > channel lock is excessive and can be removed safely. This has been > tested on > Intel Medfield and Merrifield. Please, ignore this. It's an old version. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > --- > drivers/dma/hsu/hsu.c | 52 +++-------------------------------------- > ---------- > drivers/dma/hsu/hsu.h | 1 - > 2 files changed, 3 insertions(+), 50 deletions(-) > > diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c > index f42f71e..729bcc9 100644 > --- a/drivers/dma/hsu/hsu.c > +++ b/drivers/dma/hsu/hsu.c > @@ -99,21 +99,13 @@ static void hsu_dma_chan_start(struct > hsu_dma_chan *hsuc) > > static void hsu_dma_stop_channel(struct hsu_dma_chan *hsuc) > { > - unsigned long flags; > - > - spin_lock_irqsave(&hsuc->lock, flags); > hsu_chan_disable(hsuc); > hsu_chan_writel(hsuc, HSU_CH_DCR, 0); > - spin_unlock_irqrestore(&hsuc->lock, flags); > } > > static void hsu_dma_start_channel(struct hsu_dma_chan *hsuc) > { > - unsigned long flags; > - > - spin_lock_irqsave(&hsuc->lock, flags); > hsu_dma_chan_start(hsuc); > - spin_unlock_irqrestore(&hsuc->lock, flags); > } > > static void hsu_dma_start_transfer(struct hsu_dma_chan *hsuc) > @@ -134,23 +126,10 @@ static void hsu_dma_start_transfer(struct > hsu_dma_chan *hsuc) > hsu_dma_start_channel(hsuc); > } > > -static u32 hsu_dma_chan_get_sr(struct hsu_dma_chan *hsuc) > -{ > - unsigned long flags; > - u32 sr; > - > - spin_lock_irqsave(&hsuc->lock, flags); > - sr = hsu_chan_readl(hsuc, HSU_CH_SR); > - spin_unlock_irqrestore(&hsuc->lock, flags); > - > - return sr; > -} > - > irqreturn_t hsu_dma_irq(struct hsu_dma_chip *chip, unsigned short > nr) > { > struct hsu_dma_chan *hsuc; > struct hsu_dma_desc *desc; > - unsigned long flags; > u32 sr; > > /* Sanity check */ > @@ -163,7 +142,7 @@ irqreturn_t hsu_dma_irq(struct hsu_dma_chip > *chip, unsigned short nr) > * No matter what situation, need read clear the IRQ status > * There is a bug, see Errata 5, HSD 2900918 > */ > - sr = hsu_dma_chan_get_sr(hsuc); > + sr = hsu_chan_readl(hsuc, HSU_CH_SR); > if (!sr) > return IRQ_NONE; > > @@ -175,7 +154,6 @@ irqreturn_t hsu_dma_irq(struct hsu_dma_chip > *chip, unsigned short nr) > if (!sr) > return IRQ_HANDLED; > > - spin_lock_irqsave(&hsuc->vchan.lock, flags); > desc = hsuc->desc; > if (desc) { > if (sr & HSU_CH_SR_CHE) { > @@ -188,7 +166,6 @@ irqreturn_t hsu_dma_irq(struct hsu_dma_chip > *chip, unsigned short nr) > hsu_dma_start_transfer(hsuc); > } > } > - spin_unlock_irqrestore(&hsuc->vchan.lock, flags); > > return IRQ_HANDLED; > } > @@ -273,14 +250,11 @@ static size_t hsu_dma_active_desc_size(struct > hsu_dma_chan *hsuc) > struct hsu_dma_desc *desc = hsuc->desc; > size_t bytes = hsu_dma_desc_size(desc); > int i; > - unsigned long flags; > > - spin_lock_irqsave(&hsuc->lock, flags); > i = desc->active % HSU_DMA_CHAN_NR_DESC; > do { > bytes += hsu_chan_readl(hsuc, HSU_CH_DxTSR(i)); > } while (--i >= 0); > - spin_unlock_irqrestore(&hsuc->lock, flags); > > return bytes; > } > @@ -327,24 +301,6 @@ static int hsu_dma_slave_config(struct dma_chan > *chan, > return 0; > } > > -static void hsu_dma_chan_deactivate(struct hsu_dma_chan *hsuc) > -{ > - unsigned long flags; > - > - spin_lock_irqsave(&hsuc->lock, flags); > - hsu_chan_disable(hsuc); > - spin_unlock_irqrestore(&hsuc->lock, flags); > -} > - > -static void hsu_dma_chan_activate(struct hsu_dma_chan *hsuc) > -{ > - unsigned long flags; > - > - spin_lock_irqsave(&hsuc->lock, flags); > - hsu_chan_enable(hsuc); > - spin_unlock_irqrestore(&hsuc->lock, flags); > -} > - > static int hsu_dma_pause(struct dma_chan *chan) > { > struct hsu_dma_chan *hsuc = to_hsu_dma_chan(chan); > @@ -352,7 +308,7 @@ static int hsu_dma_pause(struct dma_chan *chan) > > spin_lock_irqsave(&hsuc->vchan.lock, flags); > if (hsuc->desc && hsuc->desc->status == DMA_IN_PROGRESS) { > - hsu_dma_chan_deactivate(hsuc); > + hsu_chan_disable(hsuc); > hsuc->desc->status = DMA_PAUSED; > } > spin_unlock_irqrestore(&hsuc->vchan.lock, flags); > @@ -368,7 +324,7 @@ static int hsu_dma_resume(struct dma_chan *chan) > spin_lock_irqsave(&hsuc->vchan.lock, flags); > if (hsuc->desc && hsuc->desc->status == DMA_PAUSED) { > hsuc->desc->status = DMA_IN_PROGRESS; > - hsu_dma_chan_activate(hsuc); > + hsu_chan_enable(hsuc); > } > spin_unlock_irqrestore(&hsuc->vchan.lock, flags); > > @@ -441,8 +397,6 @@ int hsu_dma_probe(struct hsu_dma_chip *chip) > > hsuc->direction = (i & 0x1) ? DMA_DEV_TO_MEM : > DMA_MEM_TO_DEV; > hsuc->reg = addr + i * HSU_DMA_CHAN_LENGTH; > - > - spin_lock_init(&hsuc->lock); > } > > dma_cap_set(DMA_SLAVE, hsu->dma.cap_mask); > diff --git a/drivers/dma/hsu/hsu.h b/drivers/dma/hsu/hsu.h > index 0275233..eeb9fff 100644 > --- a/drivers/dma/hsu/hsu.h > +++ b/drivers/dma/hsu/hsu.h > @@ -78,7 +78,6 @@ struct hsu_dma_chan { > struct virt_dma_chan vchan; > > void __iomem *reg; > - spinlock_t lock; > > /* hardware configuration */ > enum dma_transfer_direction direction; -- Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html