From: vkoul@infradead.org (Vinod Koul)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] DMA: AT91: Get residual bytes in dma buffer
Date: Thu, 21 Mar 2013 13:34:15 +0530 [thread overview]
Message-ID: <1363853055.2348.11.camel@vkoul-udesk3> (raw)
In-Reply-To: <1354871509-14690-1-git-send-email-elen.song@atmel.com>
On Fri, 2012-12-07 at 17:11 +0800, Elen Song wrote:
> + * atc_get_bytes_left -
> + * Get the number of bytes residue in dma buffer,
> + * the channel should be paused when calling this
> + * @chan: the channel we want to start
> + */
> +static int atc_get_bytes_left(struct dma_chan *chan)
> +{
> + struct at_dma_chan *atchan = to_at_dma_chan(chan);
> + struct at_desc *desc_first = atc_first_active(atchan);
> + struct at_desc *desc_cur;
> + int ret = 0, count = 0;
> +
> + /*
> + * Initialize necessary values in the first time.
> + * remain_desc record remain desc length.
> + */
> + if (atchan->remain_desc == 0)
> + /* First descriptor embedds the transaction length */
> + atchan->remain_desc = desc_first->len;
> +
> + /* Channel should be paused before get residue */
> + if (!atc_chan_is_paused(atchan))
> + atc_control(chan, DMA_PAUSE, 0);
This one doesnt seem good, why should you pause if you want to read
residue.
Why cant you read the value while it running.
Also if the query is done for a paused channel then you would resume it,
which is wrong
--
Vinod Koul
Intel Corp.
prev parent reply other threads:[~2013-03-21 8:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 9:11 [PATCH 2/3] DMA: AT91: Get residual bytes in dma buffer Elen Song
2013-03-21 8:04 ` Vinod Koul [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363853055.2348.11.camel@vkoul-udesk3 \
--to=vkoul@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox