From: Haavard Skinnemoen <email@example.com>
To: Ben Nizette <firstname.lastname@example.org>
Cc: email@example.com, firstname.lastname@example.org,
Linux Kernel list <email@example.com>,
Subject: Re: [PATCH] atmel_spi: fix dma addr calculation for len > BUFFER_SIZE
Date: Mon, 28 Sep 2009 09:12:59 +0200 [thread overview]
Message-ID: <20090928091259.27485716@hskinnemoen-d830> (raw)
Ben Nizette <firstname.lastname@example.org> wrote:
> If len > BUFFER_LEN and !xfer->rx_buf we end up calculating the tx
> buffer address as
> *tx_dma = xfer->tx_dma + xfer->len - BUFFER_SIZE;
> which is constant; i.e. we just send the last BUFFER_SIZE data over
> again until we've reached the right number of bytes.
> This patch gets around this by using the /requested/ length when
> calculating addresses.
> Note there's no way len != *plen when we calculate the rx buffer address
> but conceptually we should be using *plen and I don't want someone to
> come through later, see the calculations for rx and tx are different and
> "clean up" back to what we had.
> Signed-off-by: Ben Nizette <email@example.com>
Wow, that is subtle. I had to stare at it for a long while before I
understood what's going on, but I believe you're right.
Acked-by: Haavard Skinnemoen <firstname.lastname@example.org>
While you're at it, could you send another patch renaming 'len' to
'next_len'? I think that would make it a bit more obvious why your
patch is correct and prevent similar mistakes in the future.
next prev parent reply other threads:[~2009-09-28 7:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-27 5:26 [PATCH] atmel_spi: fix dma addr calculation for len > BUFFER_SIZE Ben Nizette
2009-09-28 7:12 ` Haavard Skinnemoen [this message]
2009-09-29 0:55 ` Ben Nizette
2009-09-29 6:57 ` Haavard Skinnemoen
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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;
as well as URLs for NNTP newsgroup(s).