From patchwork Tue Jan 29 12:27:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hiroshi Doyu X-Patchwork-Id: 14333 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 AC99D23E57 for ; Tue, 29 Jan 2013 12:27:50 +0000 (UTC) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by fiordland.canonical.com (Postfix) with ESMTP id 4F630A1895E for ; Tue, 29 Jan 2013 12:27:50 +0000 (UTC) Received: by mail-ve0-f177.google.com with SMTP id m1so222000ves.22 for ; Tue, 29 Jan 2013 04:27:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-pgp-universal:from:to:date:message-id:x-mailer :in-reply-to:references:mime-version: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=FP+X99xVWrJub9bVk5bULP01ftlRuo7tcn2zNfIDcnM=; b=ZlCahQXpiYwyHZXiQr3SVFw+qweXlGAPFVX65tcGbf+odvaxq2GuDTh3l//Lom3RLs MQWI9Aw3dbr6LdlceNmL7rd5j6RFzXb9eoqwRrjzOj/jfNfn8SETsSX/RBIbrvkpudhp Ih/FwOCASdG92IZCySfwQY7gOfx0mUIavulCwGxJlQOaUXPKGWwF8CGdTWavDpLAP5na Lk4FLwpW60c1JRoMrIf+ewu2etMqaMXgiaHXPP54zJMbGbcfCn43lnwPAMRfLmz95MMa wZSbW5jZrCd1KvCp5ZkBz+yTftld4AA/eavYZ+9ZRjvCG+EUR9Xi/ePQax6vIKa0FamR Abqg== X-Received: by 10.220.149.82 with SMTP id s18mr763968vcv.14.1359462469722; Tue, 29 Jan 2013 04:27:49 -0800 (PST) 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.58.145.101 with SMTP id st5csp133428veb; Tue, 29 Jan 2013 04:27:49 -0800 (PST) X-Received: by 10.14.194.195 with SMTP id m43mr2788298een.44.1359462468661; Tue, 29 Jan 2013 04:27:48 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id l1si22178965een.243.2013.01.29.04.27.48; Tue, 29 Jan 2013 04:27:48 -0800 (PST) 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 1U0AHv-0003XP-DF; Tue, 29 Jan 2013 12:27:43 +0000 Received: from hqemgate04.nvidia.com ([216.228.121.35]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U0AHt-0003XJ-W4 for linaro-mm-sig@lists.linaro.org; Tue, 29 Jan 2013 12:27:42 +0000 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Tue, 29 Jan 2013 04:27:20 -0800 Received: from hqemhub02.nvidia.com ([172.17.108.22]) by hqnvupgp07.nvidia.com (PGP Universal service); Tue, 29 Jan 2013 04:27:14 -0800 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Tue, 29 Jan 2013 04:27:14 -0800 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server id 8.3.297.1; Tue, 29 Jan 2013 04:27:32 -0800 Received: from thelma.nvidia.com (Not Verified[172.16.212.77]) by hqnvemgw02.nvidia.com with MailMarshal (v6,7,2,8378) id ; Tue, 29 Jan 2013 04:27:32 -0800 Received: from oreo.Nvidia.com (dhcp-10-21-25-186.nvidia.com [10.21.25.186]) by thelma.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id r0TCRTZ5023022; Tue, 29 Jan 2013 04:27:30 -0800 (PST) From: Hiroshi Doyu To: Date: Tue, 29 Jan 2013 14:27:18 +0200 Message-ID: <1359462438-21006-1-git-send-email-hdoyu@nvidia.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <5107B301.2060802@samsung.com> References: <5107B301.2060802@samsung.com> MIME-Version: 1.0 Cc: linaro-mm-sig@lists.linaro.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [Linaro-mm-sig] [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() if no ->set_dma_mask() 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: ALoCoQmz019pqSrFRnxvCzsWUpjo7prcRyQrZwAPi6LcaHCEpY2ptt5G0HN17JTIKi9u/2HabhCD struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes crash when dma_set_mask() is called from some driver. Signed-off-by: Hiroshi Doyu --- arch/arm/include/asm/dma-mapping.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 5b579b9..63cc49c 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -14,6 +14,7 @@ #define DMA_ERROR_CODE (~0) extern struct dma_map_ops arm_dma_ops; extern struct dma_map_ops arm_coherent_dma_ops; +extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); static inline struct dma_map_ops *get_dma_ops(struct device *dev) { @@ -32,7 +33,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) static inline int dma_set_mask(struct device *dev, u64 mask) { - return get_dma_ops(dev)->set_dma_mask(dev, mask); + struct dma_map_ops *ops = get_dma_ops(dev); + BUG_ON(!ops); + + if (ops->set_dma_mask) + return ops->set_dma_mask(dev, mask); + + return arm_dma_set_mask(dev, mask); } #ifdef __arch_page_to_dma @@ -112,8 +119,6 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size, extern int dma_supported(struct device *dev, u64 mask); -extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); - /** * arm_dma_alloc - allocate consistent memory for DMA * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices