From patchwork Thu Sep 13 15:17:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10599729 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41FE217DF for ; Thu, 13 Sep 2018 15:17:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B8022B0D5 for ; Thu, 13 Sep 2018 15:17:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E0262B0DE; Thu, 13 Sep 2018 15:17:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5C512B0D5 for ; Thu, 13 Sep 2018 15:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728366AbeIMU1Z (ORCPT ); Thu, 13 Sep 2018 16:27:25 -0400 Received: from sauhun.de ([88.99.104.3]:38928 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728291AbeIMU1Y (ORCPT ); Thu, 13 Sep 2018 16:27:24 -0400 Received: from localhost (p54B3335A.dip0.t-ipconnect.de [84.179.51.90]) by pokefinder.org (Postfix) with ESMTPSA id 8D4D62CF689; Thu, 13 Sep 2018 17:17:25 +0200 (CEST) From: Wolfram Sang To: iommu@lists.linux-foundation.org, Robin Murphy , Christoph Hellwig Cc: linux-renesas-soc@vger.kernel.org, Marek Szyprowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Wolfram Sang Subject: [RFC PATCH 2/3] dma-mapping: clear dma_ops pointer also on ARM Date: Thu, 13 Sep 2018 17:17:15 +0200 Message-Id: <20180913151716.6333-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> References: <20180913151716.6333-1-wsa+renesas@sang-engineering.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The generic fallback of arch_teardown_dma_ops() clears the dma_ops pointer but the ARM specific version does not. Rename the generic one, so it can be called from ARM specific one, too. This will ensure consistent behaviour. Signed-off-by: Wolfram Sang --- arch/arm/mm/dma-mapping.c | 6 +++--- include/linux/dma-mapping.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e3b04786838f..466b0242e8af 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2396,8 +2396,8 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, void arch_teardown_dma_ops(struct device *dev) { - if (!dev->archdata.dma_ops_setup) - return; + if (dev->archdata.dma_ops_setup) + arm_teardown_iommu_dma_ops(dev); - arm_teardown_iommu_dma_ops(dev); + generic_teardown_dma_ops(dev); } diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index eafd6f318e78..020512cb7f0e 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -663,11 +663,12 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, bool coherent) { } #endif -#ifndef arch_teardown_dma_ops -static inline void arch_teardown_dma_ops(struct device *dev) +static inline void generic_teardown_dma_ops(struct device *dev) { dev->dma_ops = NULL; } +#ifndef arch_teardown_dma_ops +#define arch_teardown_dma_ops generic_teardown_dma_ops #endif static inline unsigned int dma_get_max_seg_size(struct device *dev)