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

From: Xiang Wang
Date: Tue Jun 18 2013 - 04:47:12 EST


2013/6/17 Vinod Koul <vinod.koul@xxxxxxxxx>:
> 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
Updated in patch set V3. Thanks!
>> +{
>> + struct mmp_pdma_device *pdev = to_mmp_pdma_dev(pchan->chan.device);
>> + unsigned long flags;
> empty line pls
Updated in patch set V3. Thanks!
>
>> + 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



--
Regards,
Xiang
--
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/