From patchwork Wed Jul 31 19:54:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 2836572 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E4510C0319 for ; Wed, 31 Jul 2013 19:57:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4B0C202BE for ; Wed, 31 Jul 2013 19:57:28 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4503B202B9 for ; Wed, 31 Jul 2013 19:57:27 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V4cVT-00077u-QF; Wed, 31 Jul 2013 19:56:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V4cV0-00014U-9B; Wed, 31 Jul 2013 19:55:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V4cUL-0000xv-GH for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2013 19:55:15 +0000 X-IronPort-AV: E=Sophos;i="4.89,789,1367971200"; d="scan'208";a="40581749" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP/TLS/AES128-SHA; 31 Jul 2013 19:54:30 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Wed, 31 Jul 2013 15:54:29 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1V4cTY-0006FD-W0; Wed, 31 Jul 2013 20:54:25 +0100 From: Stefano Stabellini To: Subject: [PATCH v2 RFC 2/8] arm: introduce a global dma_ops pointer Date: Wed, 31 Jul 2013 20:54:06 +0100 Message-ID: <1375300452-12545-2-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130731_155513_756894_9B3A8423 X-CRM114-Status: GOOD ( 10.44 ) X-Spam-Score: -8.4 (--------) Cc: linux@arm.linux.org.uk, Ian.Campbell@citrix.com, Stefano Stabellini , konrad.wilk@oracle.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 Initially set dma_ops to arm_dma_ops. Use dma_ops instead of arm_dma_ops in dmabounce. Signed-off-by: Stefano Stabellini CC: will.deacon@arm.com CC: linux@arm.linux.org.uk --- arch/arm/common/dmabounce.c | 10 +++++----- arch/arm/include/asm/dma-mapping.h | 3 ++- arch/arm/mm/dma-mapping.c | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 1143c4d..b626122 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c @@ -325,7 +325,7 @@ static dma_addr_t dmabounce_map_page(struct device *dev, struct page *page, return DMA_ERROR_CODE; if (ret == 0) { - arm_dma_ops.sync_single_for_device(dev, dma_addr, size, dir); + dma_ops->sync_single_for_device(dev, dma_addr, size, dir); return dma_addr; } @@ -353,7 +353,7 @@ static void dmabounce_unmap_page(struct device *dev, dma_addr_t dma_addr, size_t buf = find_safe_buffer_dev(dev, dma_addr, __func__); if (!buf) { - arm_dma_ops.sync_single_for_cpu(dev, dma_addr, size, dir); + dma_ops->sync_single_for_cpu(dev, dma_addr, size, dir); return; } @@ -397,7 +397,7 @@ static void dmabounce_sync_for_cpu(struct device *dev, if (!__dmabounce_sync_for_cpu(dev, handle, size, dir)) return; - arm_dma_ops.sync_single_for_cpu(dev, handle, size, dir); + dma_ops->sync_single_for_cpu(dev, handle, size, dir); } static int __dmabounce_sync_for_device(struct device *dev, dma_addr_t addr, @@ -437,7 +437,7 @@ static void dmabounce_sync_for_device(struct device *dev, if (!__dmabounce_sync_for_device(dev, handle, size, dir)) return; - arm_dma_ops.sync_single_for_device(dev, handle, size, dir); + dma_ops->sync_single_for_device(dev, handle, size, dir); } static int dmabounce_set_mask(struct device *dev, u64 dma_mask) @@ -445,7 +445,7 @@ static int dmabounce_set_mask(struct device *dev, u64 dma_mask) if (dev->archdata.dmabounce) return 0; - return arm_dma_ops.set_dma_mask(dev, dma_mask); + return dma_ops->set_dma_mask(dev, dma_mask); } static struct dma_map_ops dmabounce_ops = { diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index ad89e0f..f907f65 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -12,6 +12,7 @@ #include #define DMA_ERROR_CODE (~0) +extern struct dma_map_ops *dma_ops; extern struct dma_map_ops arm_dma_ops; extern struct dma_map_ops arm_coherent_dma_ops; @@ -19,7 +20,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) { if (dev && dev->archdata.dma_ops) return dev->archdata.dma_ops; - return &arm_dma_ops; + return dma_ops; } static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 7f9b179..870b12c 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -141,6 +141,9 @@ struct dma_map_ops arm_dma_ops = { }; EXPORT_SYMBOL(arm_dma_ops); +struct dma_map_ops *dma_ops = &arm_dma_ops; +EXPORT_SYMBOL(dma_ops); + static void *arm_coherent_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs); static void arm_coherent_dma_free(struct device *dev, size_t size, void *cpu_addr,