Re: [PATCH v3 4/4] dw_dmac: return proper residue value

From: Andy Shevchenko
Date: Thu Jan 24 2013 - 05:48:32 EST


On Thu, Jan 24, 2013 at 12:45 PM, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> On Thu, Jan 24, 2013 at 4:04 PM, Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> I don't see residue - len from interrupt handler. It isn't required?

Where exactly?

>> @@ -1062,6 +1090,7 @@ dwc_tx_status(struct dma_chan *chan,
>> struct dma_tx_state *txstate)
>> {
>> struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
>> + unsigned long flags;
>> enum dma_status ret;
>>
>> ret = dma_cookie_status(chan, cookie, txstate);
>> @@ -1071,8 +1100,17 @@ dwc_tx_status(struct dma_chan *chan,
>> ret = dma_cookie_status(chan, cookie, txstate);
>> }
>>
>> - if (ret != DMA_SUCCESS)
>> - dma_set_residue(txstate, dwc_first_active(dwc)->len);
>> + spin_lock_irqsave(&dwc->lock, flags);
>> +
>> + if (ret != DMA_SUCCESS) {
>> + u32 residue = dwc->residue;
>
> If you agree with the explanation that i gave in last mail, you must drop lock
> right here. and also take it in this if block.

Yes, I agreed with that. Okay, I will move lock inside this block.

>> + if (test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags) && residue)
>> + residue -= dwc_get_sent(dwc);
>> + dma_set_residue(txstate, residue);
>> + }
>> +
>> + spin_unlock_irqrestore(&dwc->lock, flags);
>
> other than that:
>
> Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> --
> 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/



--
With Best Regards,
Andy Shevchenko
--
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/