From patchwork Mon Apr 11 02:47:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 8796131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 06E2C9F3D1 for ; Mon, 11 Apr 2016 03:00:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 336AE20256 for ; Mon, 11 Apr 2016 03:00:17 +0000 (UTC) Received: from bombadil.infradead.org (unknown [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7211C201F5 for ; Mon, 11 Apr 2016 03:00:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1apRvY-0005Pz-Mq; Mon, 11 Apr 2016 02:50:12 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1apRvV-0004AZ-Hd for linux-arm-kernel@lists.infradead.org; Mon, 11 Apr 2016 02:50:10 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFC8920268; Mon, 11 Apr 2016 02:49:32 +0000 (UTC) Received: from localhost.localdomain (unknown [180.106.219.142]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B8C120260; Mon, 11 Apr 2016 02:49:30 +0000 (UTC) From: Shawn Guo To: Catalin Marinas , Will Deacon Subject: [PATCH] scatterlist: use sg_dma_len() in sg_set_page() Date: Mon, 11 Apr 2016 10:47:44 +0800 Message-Id: <1460342864-27891-1-git-send-email-shawnguo@kernel.org> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RDNS_NONE,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160410_195009_632146_9A5E532A X-CRM114-Status: GOOD ( 14.96 ) X-Spam-Score: -5.2 (-----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Andrew Morton , Shawn Guo , linux-kernel@vger.kernel.org, Arnd Bergmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)