From patchwork Tue Mar 27 13:42:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7496 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5029923E01 for ; Tue, 27 Mar 2012 14:20:14 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 206D8A187CA for ; Tue, 27 Mar 2012 14:20:14 +0000 (UTC) Received: by mail-gx0-f180.google.com with SMTP id u1so5713363ggl.11 for ; Tue, 27 Mar 2012 07:20:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :in-reply-to:to:message-id:mime-version:x-mailer:references :x-mailman-approved-at:cc:subject:x-beenthere:x-mailman-version :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:content-type:content-transfer-encoding :sender:errors-to:x-gm-message-state; bh=iXCkdYbD9OLqKjr8eJJuwHZltgVbqcy5csbGz5taLWU=; b=hLqBMJVSNotdMBGJ8M1NGmxWWDj4PmzIgApxDWGKiNRMzLzqJ917geqWGV1ismEV4W 81t0ckSduhNim3JUw/ESb8yb21k88vpg4G+s+S+ENhJA8V1H92WL1Y1/Qujda7N7M5Hq Ihoog0FXBuAcQtIw0dOXa2DY+n1kw28XqgFcaar4eKPt340zQayE2nBvTsVX9twiloeU fV7vnhOHuDet+E2neHm2pAAN9Pw36LDfpzPRq0oTMOIZWYToW8/mmBQbfMfKvVteIEjc oKg5AEHsLB9DhcKsQ0S4dWM9G80orBq3QRuu5goylo/peXWnpV6wM3z1gRkgk+QJ0f5F jqCA== Received: by 10.50.45.234 with SMTP id q10mr8872935igm.54.1332858013669; Tue, 27 Mar 2012 07:20:13 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.5.205 with SMTP id 13csp18946ibw; Tue, 27 Mar 2012 07:20:11 -0700 (PDT) Received: by 10.180.105.194 with SMTP id go2mr28056903wib.22.1332858004968; Tue, 27 Mar 2012 07:20:04 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id l32si20783475weq.32.2012.03.27.07.20.03; Tue, 27 Mar 2012 07:20:04 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SCXFi-00075m-Nj; Tue, 27 Mar 2012 14:20:02 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SCWgK-00016T-Pa for linaro-mm-sig@lists.linaro.org; Tue, 27 Mar 2012 13:43:28 +0000 Received: from euspt2 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M1J00BNHQ3IIW@mailout1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 27 Mar 2012 14:42:56 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M1J0022WQ491V@spt2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 27 Mar 2012 14:43:23 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 9ACCD270051; Tue, 27 Mar 2012 15:46:11 +0200 (CEST) Date: Tue, 27 Mar 2012 15:42:41 +0200 From: Marek Szyprowski In-reply-to: <1332855768-32583-1-git-send-email-m.szyprowski@samsung.com> To: linux-kernel@vger.kernel.org Message-id: <1332855768-32583-8-git-send-email-m.szyprowski@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.9.1 References: <1332855768-32583-1-git-send-email-m.szyprowski@samsung.com> X-Mailman-Approved-At: Tue, 27 Mar 2012 14:19:40 +0000 Cc: linux-mips@linux-mips.org, Kevin Cernekee , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Benjamin Herrenschmidt , linux-mm@kvack.org, sparclinux@vger.kernel.org, Guan Xuetao , linux-arch@vger.kernel.org, Stephen Rothwell , Jonathan Corbet , x86@kernel.org, Matt Turner , Dezhong Diao , Fenghua Yu , Arnd Bergmann , microblaze-uclinux@itee.uq.edu.au, linaro-mm-sig@lists.linaro.org, Ivan Kokshaysky , Andrzej Pietrasiewicz , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Richard Henderson , discuss@x86-64.org, Michal Simek , Tony Luck , Richard Kuo , FUJITA Tomonori , Kyungmin Park , Paul Mundt , linux-alpha@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Subject: [Linaro-mm-sig] [PATCHv2 07/14] SH: adapt for dma_map_ops changes X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQngpPeYGL+zw2Z3Y/toDCDj4aRuUZX8XFFDO78cFBPS2CqSga7ugd1jaZCQeRsPd6yK/gT5 From: Andrzej Pietrasiewicz Adapt core SH architecture code for dma_map_ops changes: replace alloc/free_coherent with generic alloc/free methods. Signed-off-by: Andrzej Pietrasiewicz Acked-by: Kyungmin Park Signed-off-by: Marek Szyprowski Reviewed-by: Arnd Bergmann Acked-by: Paul Mundt --- arch/sh/include/asm/dma-mapping.h | 28 ++++++++++++++++++---------- arch/sh/kernel/dma-nommu.c | 4 ++-- arch/sh/mm/consistent.c | 6 ++++-- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index 1a73c3e..8bd965e 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h @@ -52,25 +52,31 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) return dma_addr == 0; } -static inline void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp) +#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) + +static inline void *dma_alloc_attrs(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t gfp, + struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); void *memory; if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) return memory; - if (!ops->alloc_coherent) + if (!ops->alloc) return NULL; - memory = ops->alloc_coherent(dev, size, dma_handle, gfp); + memory = ops->alloc(dev, size, dma_handle, gfp, attrs); debug_dma_alloc_coherent(dev, size, *dma_handle, memory); return memory; } -static inline void dma_free_coherent(struct device *dev, size_t size, - void *vaddr, dma_addr_t dma_handle) +#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) + +static inline void dma_free_attrs(struct device *dev, size_t size, + void *vaddr, dma_addr_t dma_handle, + struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); @@ -78,14 +84,16 @@ static inline void dma_free_coherent(struct device *dev, size_t size, return; debug_dma_free_coherent(dev, size, vaddr, dma_handle); - if (ops->free_coherent) - ops->free_coherent(dev, size, vaddr, dma_handle); + if (ops->free) + ops->free(dev, size, vaddr, dma_handle, attrs); } /* arch/sh/mm/consistent.c */ extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_addr, gfp_t flag); + dma_addr_t *dma_addr, gfp_t flag, + struct dma_attrs *attrs); extern void dma_generic_free_coherent(struct device *dev, size_t size, - void *vaddr, dma_addr_t dma_handle); + void *vaddr, dma_addr_t dma_handle, + struct dma_attrs *attrs); #endif /* __ASM_SH_DMA_MAPPING_H */ diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c index 3c55b87..5b0bfcd 100644 --- a/arch/sh/kernel/dma-nommu.c +++ b/arch/sh/kernel/dma-nommu.c @@ -63,8 +63,8 @@ static void nommu_sync_sg(struct device *dev, struct scatterlist *sg, #endif struct dma_map_ops nommu_dma_ops = { - .alloc_coherent = dma_generic_alloc_coherent, - .free_coherent = dma_generic_free_coherent, + .alloc = dma_generic_alloc_coherent, + .free = dma_generic_free_coherent, .map_page = nommu_map_page, .map_sg = nommu_map_sg, #ifdef CONFIG_DMA_NONCOHERENT diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c index f251b5f..b81d9db 100644 --- a/arch/sh/mm/consistent.c +++ b/arch/sh/mm/consistent.c @@ -33,7 +33,8 @@ static int __init dma_init(void) fs_initcall(dma_init); void *dma_generic_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp) + dma_addr_t *dma_handle, gfp_t gfp, + struct dma_attrs *attrs) { void *ret, *ret_nocache; int order = get_order(size); @@ -64,7 +65,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, } void dma_generic_free_coherent(struct device *dev, size_t size, - void *vaddr, dma_addr_t dma_handle) + void *vaddr, dma_addr_t dma_handle, + struct dma_attrs *attrs) { int order = get_order(size); unsigned long pfn = dma_handle >> PAGE_SHIFT;