Re: [PATCH v2 1/5] dmaengine: add ep93xx DMA support

From: Vinod Koul
Date: Mon Nov 21 2011 - 03:36:00 EST


On Mon, 2011-11-21 at 10:01 +0200, Mika Westerberg wrote:
> On Mon, Nov 21, 2011 at 08:44:07AM +0100, Rafal Prylowski wrote:
> >
> > I'm calling dma_terminate_all from interrupt. It seems that tasklet_kill is not
> > allowed to be called from this context.
>
> Ah, right.
>
> One more try - this time we set a flag which prevents the tasktlet from
> referencing an empty list.
Rather than this why not actually check for list_empty and process only
when it is not empty?
Also you should check the return of the ep93xx_dma_get_active() which
should return NULL if it didn't find anything in active list
>
> diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
> index 6181811..f7244b3 100644
> --- a/drivers/dma/ep93xx_dma.c
> +++ b/drivers/dma/ep93xx_dma.c
> @@ -155,6 +155,8 @@ struct ep93xx_dma_chan {
> unsigned long flags;
> /* Channel is configured for cyclic transfers */
> #define EP93XX_DMA_IS_CYCLIC 0
> +/* Channel is enabled */
> +#define EP93xx_DMA_IS_RUNNING 1
>
> int buffer;
> dma_cookie_t last_completed;
> @@ -673,6 +675,9 @@ static void ep93xx_dma_tasklet(unsigned long data)
> void *callback_param;
> LIST_HEAD(list);
>
> + if (!test_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags))
> + return;
> +
> spin_lock_irq(&edmac->lock);
> desc = ep93xx_dma_get_active(edmac);
> if (desc->complete) {
> @@ -758,6 +763,8 @@ static dma_cookie_t ep93xx_dma_tx_submit(struct dma_async_tx_descriptor *tx)
> edmac->chan.cookie = cookie;
> desc->txd.cookie = cookie;
>
> + set_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
> +
> /*
> * If nothing is currently prosessed, we push this descriptor
> * directly to the hardware. Otherwise we put the descriptor
> @@ -1106,6 +1113,7 @@ static int ep93xx_dma_terminate_all(struct ep93xx_dma_chan *edmac)
> spin_lock_irqsave(&edmac->lock, flags);
> /* First we disable and flush the DMA channel */
> edmac->edma->hw_shutdown(edmac);
> + clear_bit(EP93XX_DMA_IS_RUNNING, &edmac->flags);
> clear_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags);
> list_splice_init(&edmac->active, &list);
> list_splice_init(&edmac->queue, &list);
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


--
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/