From: Shawn Guo <shawnguo@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Shawn Guo <shawnguo@kernel.org>
Subject: [PATCH] scatterlist: use sg_dma_len() in sg_set_page()
Date: Mon, 11 Apr 2016 10:47:44 +0800 [thread overview]
Message-ID: <1460342864-27891-1-git-send-email-shawnguo@kernel.org> (raw)
The macro sg_dma_len(sg) is commonly used to retrieve length of sg,
which could be 'dma_length' or 'length' field, depending on whether
NEED_SG_DMA_LENGTH is enabled or not. On the other hand, many driver
code use helper function sg_set_page() to set an sg entry pointing at
a page, with offset and length set up in one call. But sg_set_page()
does not consider NEED_SG_DMA_LENGTH case and only set up 'length'
field. This causes problem on platforms like ARM64, where
NEED_SG_DMA_LENGTH is enabled by default, i.e. sg_set_page() sets up
'length' while sg_dma_len(sg) returns 'dma_length' field.
The patch changes sg_set_page() to use sg_dma_len() for sg length setup
as well, so that NEED_SG_DMA_LENGTH case can be handled.
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
---
include/linux/scatterlist.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 556ec1ea2574..b0e32ea594c3 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -114,7 +114,7 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
{
sg_assign_page(sg, page);
sg->offset = offset;
- sg->length = len;
+ sg_dma_len(sg) = len;
}
static inline struct page *sg_page(struct scatterlist *sg)
--
1.9.1
next reply other threads:[~2016-04-11 2:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 2:47 Shawn Guo [this message]
2016-04-11 10:31 ` Robin Murphy
2016-04-11 12:31 ` Shawn Guo
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=1460342864-27891-1-git-send-email-shawnguo@kernel.org \
--to=shawnguo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will.deacon@arm.com \
/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
all inboxes | Powered by JetHome®