Re: [PATCH 1/2] dma: mmp_pdma: add protect when alloc/free phychannels

From: Vinod Koul
Date: Mon Jun 17 2013 - 10:05:50 EST


On Mon, Jun 03, 2013 at 04:02:08PM +0800, Xiang Wang wrote:
> From: Xiang Wang <wangx@xxxxxxxxxxx>
>
> In mmp pdma, phy channels are allocated/freed dynamically
> and frequently. But no proper protection is added.
> Conflict will happen when multi-users are requesting phy
> channels at the same time. Use spinlock to protect.
>
> Signed-off-by: Xiang Wang <wangx@xxxxxxxxxxx>
> ---
> drivers/dma/mmp_pdma.c | 41 +++++++++++++++++++++++++----------------
> 1 files changed, 25 insertions(+), 16 deletions(-)
>

> +static void free_phy(struct mmp_pdma_chan *pchan)
pls namespace this
> +{
> + struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
> + unsigned long flags;
empty line pls

> + if (!pchan->phy)
> + return;
> +
> + spin_lock_irqsave(&pdev->phy_lock, flags);
> + pchan->phy->vchan = NULL;
> + pchan->phy = NULL;
> + spin_unlock_irqrestore(&pdev->phy_lock, flags);
> +}
> +
rest looks okay

--
~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/