From nobody Sun Sep 22 09:36:23 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D4B6C433F5 for ; Thu, 17 Feb 2022 11:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239896AbiBQLjm (ORCPT ); Thu, 17 Feb 2022 06:39:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240083AbiBQLjf (ORCPT ); Thu, 17 Feb 2022 06:39:35 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED4A92AC92F; Thu, 17 Feb 2022 03:39:19 -0800 (PST) X-UUID: c6e1a8246b4e4078b30862983e863179-20220217 X-UUID: c6e1a8246b4e4078b30862983e863179-20220217 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1937200977; Thu, 17 Feb 2022 19:39:14 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Thu, 17 Feb 2022 19:39:12 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 17 Feb 2022 19:39:11 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , "Matthias Brugger" , Will Deacon CC: Robin Murphy , Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , , "AngeloGioacchino Del Regno" , , , , Subject: [PATCH v5 26/34] iommu/mediatek: Remove mtk_iommu.h Date: Thu, 17 Feb 2022 19:34:45 +0800 Message-ID: <20220217113453.13658-27-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220217113453.13658-1-yong.wu@mediatek.com> References: <20220217113453.13658-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently there is only compare_of/release_of/a suspend structure in the header file. I think it is no need to keep a header file only for these. Move these into the c file and rm this header file. I think there should be a common helper for compare_of and release_of. There is many copy in drm, it should be another topic. Signed-off-by: Yong Wu Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c | 25 ++++++++++++++++++++- drivers/iommu/mtk_iommu.h | 42 ------------------------------------ drivers/iommu/mtk_iommu_v1.c | 21 +++++++++++++++--- 3 files changed, 42 insertions(+), 46 deletions(-) delete mode 100644 drivers/iommu/mtk_iommu.h diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 1827dc732917..93c5802621d5 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,7 @@ #include #include =20 -#include "mtk_iommu.h" +#include =20 #define REG_MMU_PT_BASE_ADDR 0x000 #define MMU_PT_ADDR_MASK GENMASK(31, 7) @@ -166,6 +167,17 @@ struct mtk_iommu_iova_region { unsigned long long size; }; =20 +struct mtk_iommu_suspend_reg { + u32 misc_ctrl; + u32 dcm_dis; + u32 ctrl_reg; + u32 int_control0; + u32 int_main_control; + u32 ivrp_paddr; + u32 vld_pa_rng; + u32 wr_len_ctrl; +}; + struct mtk_iommu_plat_data { enum mtk_iommu_plat m4u_plat; u32 flags; @@ -219,6 +231,17 @@ struct mtk_iommu_domain { struct mutex mutex; /* Protect "data" in this structure */ }; =20 +/* TODO: A common helper is expected. */ +static int compare_of(struct device *dev, void *data) +{ + return dev->of_node =3D=3D data; +} + +static void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static int mtk_iommu_bind(struct device *dev) { struct mtk_iommu_data *data =3D dev_get_drvdata(dev); diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h deleted file mode 100644 index d332f9769f83..000000000000 --- a/drivers/iommu/mtk_iommu.h +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2015-2016 MediaTek Inc. - * Author: Honghui Zhang - */ - -#ifndef _MTK_IOMMU_H_ -#define _MTK_IOMMU_H_ - -#include -#include -#include -#include -#include -#include -#include - -struct mtk_iommu_suspend_reg { - union { - u32 standard_axi_mode;/* v1 */ - u32 misc_ctrl;/* v2 */ - }; - u32 dcm_dis; - u32 ctrl_reg; - u32 int_control0; - u32 int_main_control; - u32 ivrp_paddr; - u32 vld_pa_rng; - u32 wr_len_ctrl; -}; - -static inline int compare_of(struct device *dev, void *data) -{ - return dev->of_node =3D=3D data; -} - -static inline void release_of(struct device *dev, void *data) -{ - of_node_put(data); -} - -#endif diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 69903ba6c274..96facaff6d96 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -7,7 +7,6 @@ * * Based on driver/iommu/mtk_iommu.c */ -#include #include #include #include @@ -28,10 +27,9 @@ #include #include #include -#include +#include #include #include -#include "mtk_iommu.h" =20 #define REG_MMU_PT_BASE_ADDR 0x000 =20 @@ -87,6 +85,13 @@ */ #define M2701_IOMMU_PGT_SIZE SZ_4M =20 +struct mtk_iommu_suspend_reg { + u32 standard_axi_mode; + u32 dcm_dis; + u32 ctrl_reg; + u32 int_control0; +}; + struct mtk_iommu_data { void __iomem *base; int irq; @@ -110,6 +115,16 @@ struct mtk_iommu_domain { struct mtk_iommu_data *data; }; =20 +static int compare_of(struct device *dev, void *data) +{ + return dev->of_node =3D=3D data; +} + +static void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static int mtk_iommu_bind(struct device *dev) { struct mtk_iommu_data *data =3D dev_get_drvdata(dev); --=20 2.18.0