Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1734168ybe; Tue, 3 Sep 2019 02:41:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx1cEhcH4zmmdLm21O4lUIiITMGRYLuLoWYuxsaSWaLRDThzM2hyn3+zDRSJtl5gYv+eE1 X-Received: by 2002:a17:90a:eb18:: with SMTP id j24mr17359702pjz.82.1567503675119; Tue, 03 Sep 2019 02:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567503675; cv=none; d=google.com; s=arc-20160816; b=S0tG75O3c44OloTZAQNodNX1EQ0rCPpzzzqgVm8v/23/JU76w9hdm6rvMVgGfgqVnR 0yf6Qa0wVUPFbjS2oYVuBKEdTMR2gdGP2heo0axsR6BawU64yDbf+DqfBf7mTonNvRwv 0ppqtLmM20ifeeo5fZZdgXAmXd/Bz/rBl0pNeijBGeWEVPI4JWzUy+7NKMYunH2kZigt kkmNufMew0/T1AQNFEPNweMarBtZzgIs9hSwGWllc0uNHtoJ8Z9T6iCn8HJ+ewK/o19y 0Fod5v5SBE3Gewo1GEAYfZefLt/wDpA8zpJIgIb9t7iOrRjIXHAIyhMC6qlblDOUwUuG FJ1A== 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=hbEw6+yV/zuaYoalkGffRvbLEfQIx8NyrDH++ro7W+o=; b=LO6IeZ5OK54XvhEm5Lw6h/0RoL9vpY9GAtEiwUsvFAwfqMjvtYfqirwTmagm1+ahmr m9bxDQi1C6BOF0+lkplKOe7OXX2G4iSmnbxomkPST43uquTmetANhwNeBwZDJoC6oN64 6d52F9QlMS45XE8BE0wcP//PuvhRyCnG0eWeIFIjgo2X7gAzHHiaE8Fiq2PXnvq5F6If byYuCDOAlxhbkmIFxxfZCvO1gtScyikBRoxU9XGd2Z5JbU0gC1OKorIAyYyM471cQpdB w0rXrJZefUfwvizhdzN1Z/Ycw5KAy6DaPEXY1doetMsJnNzj/Amsaoj/9gDEUeEZD/Ak lasA== 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 t13si4704339pfe.247.2019.09.03.02.40.59; Tue, 03 Sep 2019 02:41:15 -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 S1728896AbfICJjr (ORCPT + 99 others); Tue, 3 Sep 2019 05:39:47 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:5868 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728426AbfICJjr (ORCPT ); Tue, 3 Sep 2019 05:39:47 -0400 X-UUID: 5f42c20f73a84f319014eb9f77e3288d-20190903 X-UUID: 5f42c20f73a84f319014eb9f77e3288d-20190903 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 428583172; Tue, 03 Sep 2019 17:39:40 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 3 Sep 2019 17:39:39 +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; Tue, 3 Sep 2019 17:39:38 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , Subject: [PATCH v3 10/14] iommu/mediatek: Use builtin_platform_driver Date: Tue, 3 Sep 2019 17:37:32 +0800 Message-ID: <1567503456-24725-11-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1567503456-24725-1-git-send-email-yong.wu@mediatek.com> References: <1567503456-24725-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 MediaTek IOMMU should wait for smi larb which need wait for the power domain(mtk-scpsys.c) and the multimedia ccf who both are module init. Thus, subsys_initcall for MediaTek IOMMU is not helpful. Switch to builtin_platform_driver. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 31 +------------------------------ drivers/iommu/mtk_iommu_v1.c | 24 +----------------------- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 2511b3c..109c3f2 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -735,22 +735,6 @@ static int mtk_iommu_probe(struct platform_device *pdev) return component_master_add_with_match(dev, &mtk_iommu_com_ops, match); } -static int mtk_iommu_remove(struct platform_device *pdev) -{ - struct mtk_iommu_data *data = platform_get_drvdata(pdev); - - iommu_device_sysfs_remove(&data->iommu); - iommu_device_unregister(&data->iommu); - - if (iommu_present(&platform_bus_type)) - bus_set_iommu(&platform_bus_type, NULL); - - clk_disable_unprepare(data->bclk); - devm_free_irq(&pdev->dev, data->irq, data); - component_master_del(&pdev->dev, &mtk_iommu_com_ops); - return 0; -} - static int __maybe_unused mtk_iommu_suspend(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); @@ -831,23 +815,10 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev) static struct platform_driver mtk_iommu_driver = { .probe = mtk_iommu_probe, - .remove = mtk_iommu_remove, .driver = { .name = "mtk-iommu", .of_match_table = of_match_ptr(mtk_iommu_of_ids), .pm = &mtk_iommu_pm_ops, } }; - -static int __init mtk_iommu_init(void) -{ - int ret; - - ret = platform_driver_register(&mtk_iommu_driver); - if (ret != 0) - pr_err("Failed to register MTK IOMMU driver\n"); - - return ret; -} - -subsys_initcall(mtk_iommu_init) +builtin_platform_driver(mtk_iommu_driver); diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index a7f22a2..821d483 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -660,22 +660,6 @@ static int mtk_iommu_probe(struct platform_device *pdev) return component_master_add_with_match(dev, &mtk_iommu_com_ops, match); } -static int mtk_iommu_remove(struct platform_device *pdev) -{ - struct mtk_iommu_data *data = platform_get_drvdata(pdev); - - iommu_device_sysfs_remove(&data->iommu); - iommu_device_unregister(&data->iommu); - - if (iommu_present(&platform_bus_type)) - bus_set_iommu(&platform_bus_type, NULL); - - clk_disable_unprepare(data->bclk); - devm_free_irq(&pdev->dev, data->irq, data); - component_master_del(&pdev->dev, &mtk_iommu_com_ops); - return 0; -} - static int __maybe_unused mtk_iommu_suspend(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); @@ -712,16 +696,10 @@ static int __maybe_unused mtk_iommu_resume(struct device *dev) static struct platform_driver mtk_iommu_driver = { .probe = mtk_iommu_probe, - .remove = mtk_iommu_remove, .driver = { .name = "mtk-iommu-v1", .of_match_table = mtk_iommu_of_ids, .pm = &mtk_iommu_pm_ops, } }; - -static int __init m4u_init(void) -{ - return platform_driver_register(&mtk_iommu_driver); -} -subsys_initcall(m4u_init); +builtin_platform_driver(mtk_iommu_driver); -- 1.9.1