Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp882458ybl; Wed, 21 Aug 2019 07:01:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtXjRjMkGIeS90aipyPgP36f9qZhmUPIbBLEvkmKlojgDpTQTAHUZ2FWg+lGauTwePPm3c X-Received: by 2002:a17:902:8492:: with SMTP id c18mr34520453plo.279.1566396071193; Wed, 21 Aug 2019 07:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566396071; cv=none; d=google.com; s=arc-20160816; b=J/vnu7lMagwVE9JaLCqTdv6wMJRwOq5fGUjQ8EbIB1lCZZLLrttH34qr3TEOrybETG T4v2MfermC48pHp2vZC5zAiZ9RnP/wBNt0jGeosyQgjIzj7L0graVbP2bH4Y4XJbPAhd DOp5XynkGrb3dVIYc4n8LC7ORPmoCieDOMTaqXOjl5tkvGzX/9jBU+KVpDK1LkNlRece jek1PSi4Qpx1JvcyPF2GWp7f2ZRueP/CRZ7Uh30qM7/KWNTT0CjwEPUAuZ4OQFtHt37G fWGEVTY5Yla/Vn5YVsqnqbPntK8NH34OOrdNI6MiOZWwxgb09bD4t0ZxbcT95Lb5t0zU AGQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=yO/1G7uP481gp86RjXERF6EHox2bfNoFPC8bhq2B1zM=; b=laSRuUMieUFsoPX4k2lizbzU7GRQXY1KiD43aDIexXZESSNjEYa396hKRyUdjxkTGu p1BkyRL/uaSWQBiKvFElbVFhwLvFt1Lc1fvCCooxpZsaImgOj04reTaR9P2i+3Pbh61j F2dnkYdr/78mkFKIzgzGPze8G0pU4LUyl9RfaQ5eBM4BYWo8rHmzxwS0dTEr9u6ZOzqY rhjKgYoO215u8SHta1BiQKmAhJqQpYVzxSGR36AJLlB7XAmLKH+2DwDMA0ItbMuy1bNM EGHj7CY4Zzw9eBHfzgqLQXE/EQwV/2sTdvhCV8etFkhRP2zw+HY0vHY94SVII1MZf5Mn h3Og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6si14552319pgt.13.2019.08.21.07.00.51; Wed, 21 Aug 2019 07:01:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729230AbfHUN5t (ORCPT + 99 others); Wed, 21 Aug 2019 09:57:49 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:12969 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728608AbfHUN5t (ORCPT ); Wed, 21 Aug 2019 09:57:49 -0400 X-UUID: 706f111d285045c2b0588a1c6c804fa0-20190821 X-UUID: 706f111d285045c2b0588a1c6c804fa0-20190821 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1541045567; Wed, 21 Aug 2019 21:57:41 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 21 Aug 2019 21:57:38 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 21 Aug 2019 21:57:37 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Will Deacon CC: Rob Herring , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Matthias Kaehlcke , , , Subject: [PATCH v10 23/23] iommu/mediatek: Clean up struct mtk_smi_iommu Date: Wed, 21 Aug 2019 21:53:26 +0800 Message-ID: <1566395606-7975-24-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1566395606-7975-1-git-send-email-yong.wu@mediatek.com> References: <1566395606-7975-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the "struct mtk_smi_iommu" to simplify the code since it has only one item in it right now. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 4 ++-- drivers/iommu/mtk_iommu.h | 6 +++--- drivers/iommu/mtk_iommu_v1.c | 4 ++-- drivers/memory/mtk-smi.c | 6 +++--- include/soc/mediatek/smi.h | 4 ---- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index cc81de2..400066d 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -278,7 +278,7 @@ static void mtk_iommu_config(struct mtk_iommu_data *data, for (i = 0; i < fwspec->num_ids; ++i) { larbid = MTK_M4U_TO_LARB(fwspec->ids[i]); portid = MTK_M4U_TO_PORT(fwspec->ids[i]); - larb_mmu = &data->smi_imu.larb_imu[larbid]; + larb_mmu = &data->larb_imu[larbid]; dev_dbg(dev, "%s iommu port: %d\n", enable ? "enable" : "disable", portid); @@ -680,7 +680,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) of_node_put(larbnode); return -EPROBE_DEFER; } - data->smi_imu.larb_imu[id].dev = &plarbdev->dev; + data->larb_imu[id].dev = &plarbdev->dev; component_match_add_release(dev, &match, release_of, compare_of, larbnode); diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index 56b579c..fc0f16e 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -56,7 +56,6 @@ struct mtk_iommu_data { struct mtk_iommu_suspend_reg reg; struct mtk_iommu_domain *m4u_dom; struct iommu_group *m4u_group; - struct mtk_smi_iommu smi_imu; /* SMI larb iommu info */ bool enable_4GB; bool tlb_flush_active; @@ -64,6 +63,7 @@ struct mtk_iommu_data { const struct mtk_iommu_plat_data *plat_data; struct list_head list; + struct mtk_smi_larb_iommu larb_imu[MTK_LARB_NR_MAX]; }; static inline int compare_of(struct device *dev, void *data) @@ -80,14 +80,14 @@ static inline int mtk_iommu_bind(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); - return component_bind_all(dev, &data->smi_imu); + return component_bind_all(dev, &data->larb_imu); } static inline void mtk_iommu_unbind(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); - component_unbind_all(dev, &data->smi_imu); + component_unbind_all(dev, &data->larb_imu); } #endif diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 3922358..860926c 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -206,7 +206,7 @@ static void mtk_iommu_config(struct mtk_iommu_data *data, for (i = 0; i < fwspec->num_ids; ++i) { larbid = mt2701_m4u_to_larb(fwspec->ids[i]); portid = mt2701_m4u_to_port(fwspec->ids[i]); - larb_mmu = &data->smi_imu.larb_imu[larbid]; + larb_mmu = &data->larb_imu[larbid]; dev_dbg(dev, "%s iommu port: %d\n", enable ? "enable" : "disable", portid); @@ -610,7 +610,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) } } - data->smi_imu.larb_imu[larb_nr].dev = &plarbdev->dev; + data->larb_imu[larb_nr].dev = &plarbdev->dev; component_match_add_release(dev, &match, release_of, compare_of, larb_spec.np); larb_nr++; diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index d6dc62f..439d7d8 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -143,13 +143,13 @@ void mtk_smi_larb_put(struct device *larbdev) mtk_smi_larb_bind(struct device *dev, struct device *master, void *data) { struct mtk_smi_larb *larb = dev_get_drvdata(dev); - struct mtk_smi_iommu *smi_iommu = data; + struct mtk_smi_larb_iommu *larb_mmu = data; unsigned int i; for (i = 0; i < MTK_LARB_NR_MAX; i++) { - if (dev == smi_iommu->larb_imu[i].dev) { + if (dev == larb_mmu[i].dev) { larb->larbid = i; - larb->mmu = &smi_iommu->larb_imu[i].mmu; + larb->mmu = &larb_mmu[i].mmu; return 0; } } diff --git a/include/soc/mediatek/smi.h b/include/soc/mediatek/smi.h index 6f0b00c..5a34b87 100644 --- a/include/soc/mediatek/smi.h +++ b/include/soc/mediatek/smi.h @@ -20,10 +20,6 @@ struct mtk_smi_larb_iommu { unsigned int mmu; }; -struct mtk_smi_iommu { - struct mtk_smi_larb_iommu larb_imu[MTK_LARB_NR_MAX]; -}; - /* * mtk_smi_larb_get: Enable the power domain and clocks for this local arbiter. * It also initialize some basic setting(like iommu). -- 1.9.1