From patchwork Mon Nov 26 22:31:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 10699225 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 1C0D314D6 for ; Mon, 26 Nov 2018 22:34:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 071762A5D5 for ; Mon, 26 Nov 2018 22:34:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB9502A6E0; Mon, 26 Nov 2018 22:34:27 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5763F2A5D5 for ; Mon, 26 Nov 2018 22:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BfZpwlhmZNy2LqvU/iwUdWFuxkEbJqtvxSnE9AGI69c=; b=jG9T1+mg0vNkBQ 1sC85h/uHH39EemRD/seglypPnJQFjnCfweLpL+C5/5WpNz4Rsao51f1cpRuBlFkOOOY14j+lw6eH tzq215H7qcqn4TeecwHudWPsj25Mb1T9dPxnMgXCFUiyAsdvmhINNOvYxTO+vqkr8z+RG9nP7TAbp L8IKRdq9e0aeU9i4DzhnLki7q1bACGbj908PubBrQd3+7P5LRWZ3ryIANixe/qAD60O35HDv/+CfX vOmApd6mrERwVqeH0S2DjhUKrjqPt40KyL3L/lgTyb1lJlyUwteh5Vc5whSCC8IXpik/0nh7BxDio wkhZpJagEGNyP/2nOhiw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPSO-0005sE-CK; Mon, 26 Nov 2018 22:34:20 +0000 Received: from mail5.windriver.com ([192.103.53.11] helo=mail5.wrs.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPSK-0005qW-KL; Mon, 26 Nov 2018 22:34:18 +0000 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id wAQMVvpx002166 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 26 Nov 2018 14:33:26 -0800 Received: from yow-cube1.wrs.com (128.224.56.98) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 14:32:53 -0800 From: Paul Gortmaker To: Joerg Roedel Subject: [PATCH 2/9] iommu: rockchip: make it explicitly non-modular Date: Mon, 26 Nov 2018 17:31:31 -0500 Message-ID: <1543271498-28966-3-git-send-email-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543271498-28966-1-git-send-email-paul.gortmaker@windriver.com> References: <1543271498-28966-1-git-send-email-paul.gortmaker@windriver.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181126_143416_691044_F20072DC X-CRM114-Status: GOOD ( 16.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Simon Xue , linux-rockchip@lists.infradead.org, Jeffy Chen , linux-kernel@vger.kernel.org, Daniel Kurtz , Paul Gortmaker , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Heiko Stuebner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Kconfig currently controlling compilation of this code is: drivers/iommu/Kconfig:config ROCKCHIP_IOMMU drivers/iommu/Kconfig: bool "Rockchip IOMMU Support" ...meaning that it currently is not being built as a module by anyone. The bind/unbind/remove was already explicitly disabled in commit 98b72b94def9 ("iommu/rockchip: Prohibit unbind and remove"). Lets remove the remaining traces of modular infrastructure, so that when reading the driver there is no doubt it is builtin-only. Since module_init was not in use by this code, the init ordering remains unchanged with this commit. Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments. Cc: Joerg Roedel Cc: Heiko Stuebner Cc: Simon Xue Cc: Daniel Kurtz Cc: Jeffy Chen Cc: iommu@lists.linux-foundation.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Signed-off-by: Paul Gortmaker Acked-by: Heiko Stuebner --- drivers/iommu/rockchip-iommu.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index ad3e2b97469e..c9ba9f377f63 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1,4 +1,9 @@ /* + * IOMMU API for Rockchip + * + * Module Authors: Simon Xue + * Daniel Kurtz + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. @@ -17,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -1281,7 +1286,6 @@ static const struct of_device_id rk_iommu_dt_ids[] = { { .compatible = "rockchip,iommu" }, { /* sentinel */ } }; -MODULE_DEVICE_TABLE(of, rk_iommu_dt_ids); static struct platform_driver rk_iommu_driver = { .probe = rk_iommu_probe, @@ -1299,8 +1303,3 @@ static int __init rk_iommu_init(void) return platform_driver_register(&rk_iommu_driver); } subsys_initcall(rk_iommu_init); - -MODULE_DESCRIPTION("IOMMU API for Rockchip"); -MODULE_AUTHOR("Simon Xue and Daniel Kurtz "); -MODULE_ALIAS("platform:rockchip-iommu"); -MODULE_LICENSE("GPL v2"); From patchwork Mon Nov 26 22:31:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 10699229 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 4816E13BB for ; Mon, 26 Nov 2018 22:35:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 336342A6A7 for ; Mon, 26 Nov 2018 22:35:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 250B62A74E; Mon, 26 Nov 2018 22:35:04 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0406F2A6E0 for ; Mon, 26 Nov 2018 22:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=14VGT44K6rU9A/AgeIjOZ9SzLsmRuAuQVepD3ncDE4E=; b=YtAXkdukdJ52p0 9iQfVg4bwoohtyahQlPxYJoLYjlIpf3sT5Qjw2hfQMcKL3i/lYxWNuJUBQLaoDgR52+a5u+sxw7cX 7KmDh2IvBITUU940SGLqrv1E3cJ6XWMg7V8bebPvpeNgIoXujBJVOeAVjiQ4QGZ6cehCtDyti97mF SH2KRLqYs80WIG2nTMuuObSzXhUOd2uX7JVpKYnge3TmrkAljZVQj+bZ/BtXQeFiVR1QAbMLtlBS+ uqaRoVqiaPoultTCjVAHJhoXBdvLO+Ao/aK8FcbzmO+fIVLBGB8MzA2UGUPIJP2fbLjK9KOaNswWZ CioTuDnlYD1suxY70Ppw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPSu-0006CB-Ka; Mon, 26 Nov 2018 22:34:52 +0000 Received: from mail.windriver.com ([147.11.1.11]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPSn-00066A-LA for linux-arm-kernel@lists.infradead.org; Mon, 26 Nov 2018 22:34:50 +0000 Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail.windriver.com (8.15.2/8.15.1) with ESMTPS id wAQMYTmK007478 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 26 Nov 2018 14:34:29 -0800 (PST) Received: from yow-cube1.wrs.com (128.224.56.98) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 14:34:28 -0800 From: Paul Gortmaker To: Joerg Roedel Subject: [PATCH 8/9] iommu: arm-smmu: make it explicitly non-modular Date: Mon, 26 Nov 2018 17:31:37 -0500 Message-ID: <1543271498-28966-9-git-send-email-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543271498-28966-1-git-send-email-paul.gortmaker@windriver.com> References: <1543271498-28966-1-git-send-email-paul.gortmaker@windriver.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181126_143445_701022_A5D48053 X-CRM114-Status: GOOD ( 19.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , linux-kernel@vger.kernel.org, Paul Gortmaker , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Robin Murphy , Nate Watterson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Kconfig currently controlling compilation of this code is: drivers/iommu/Kconfig:config ARM_SMMU drivers/iommu/Kconfig: bool "ARM Ltd. System MMU (SMMU) Support" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit. We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, but unlike most drivers, we can't delete the function tied to the ".remove" field. This is because as of commit 7aa8619a66ae ("iommu/arm-smmu-v3: Implement shutdown method") the .remove function was given a one line wrapper and re-used to provide a .shutdown service. So we delete the wrapper and re-name the function from remove to shutdown. We add a moduleparam.h include since the file does actually declare some module parameters, and leaving them as such is the easiest way currently to remain backwards compatible with existing use cases. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Cc: Will Deacon Cc: Joerg Roedel Cc: Robin Murphy Cc: Nate Watterson Cc: linux-arm-kernel@lists.infradead.org Cc: iommu@lists.linux-foundation.org Signed-off-by: Paul Gortmaker Acked-by: Robin Murphy --- drivers/iommu/arm-smmu.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 5a28ae892504..4a2e143fdf52 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -41,7 +41,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -101,6 +102,10 @@ #define MSI_IOVA_LENGTH 0x100000 static int force_stage; +/* + * not really modular, but the easiest way to keep compat with existing + * bootargs behaviour is to continue using module_param() here. + */ module_param(force_stage, int, S_IRUGO); MODULE_PARM_DESC(force_stage, "Force SMMU mappings to be installed at a particular stage of translation. A value of '1' or '2' forces the corresponding stage. All other values are ignored (i.e. no stage is forced). Note that selecting a specific stage will disable support for nested translation."); @@ -1964,7 +1969,6 @@ static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, { }, }; -MODULE_DEVICE_TABLE(of, arm_smmu_of_match); #ifdef CONFIG_ACPI static int acpi_smmu_get_data(u32 model, struct arm_smmu_device *smmu) @@ -2224,24 +2228,18 @@ static int arm_smmu_legacy_bus_init(void) } device_initcall_sync(arm_smmu_legacy_bus_init); -static int arm_smmu_device_remove(struct platform_device *pdev) +static void arm_smmu_device_shutdown(struct platform_device *pdev) { struct arm_smmu_device *smmu = platform_get_drvdata(pdev); if (!smmu) - return -ENODEV; + return; if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS)) dev_err(&pdev->dev, "removing device with active domains!\n"); /* Turn the thing off */ writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0); - return 0; -} - -static void arm_smmu_device_shutdown(struct platform_device *pdev) -{ - arm_smmu_device_remove(pdev); } static int __maybe_unused arm_smmu_pm_resume(struct device *dev) @@ -2256,16 +2254,12 @@ static SIMPLE_DEV_PM_OPS(arm_smmu_pm_ops, NULL, arm_smmu_pm_resume); static struct platform_driver arm_smmu_driver = { .driver = { - .name = "arm-smmu", - .of_match_table = of_match_ptr(arm_smmu_of_match), - .pm = &arm_smmu_pm_ops, + .name = "arm-smmu", + .of_match_table = of_match_ptr(arm_smmu_of_match), + .pm = &arm_smmu_pm_ops, + .suppress_bind_attrs = true, }, .probe = arm_smmu_device_probe, - .remove = arm_smmu_device_remove, .shutdown = arm_smmu_device_shutdown, }; -module_platform_driver(arm_smmu_driver); - -MODULE_DESCRIPTION("IOMMU API for ARM architected SMMU implementations"); -MODULE_AUTHOR("Will Deacon "); -MODULE_LICENSE("GPL v2"); +builtin_platform_driver(arm_smmu_driver); From patchwork Mon Nov 26 22:31:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 10699233 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 8238314D6 for ; Mon, 26 Nov 2018 22:35:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 706C02A6E0 for ; Mon, 26 Nov 2018 22:35:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6337C2A74E; Mon, 26 Nov 2018 22:35:27 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E85D92A6E0 for ; Mon, 26 Nov 2018 22:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PjkMDjhqa9wPMdYizkzsRscuKIiHjyZJL4LW7xu+dDQ=; b=TWLSi5NRcnLN1S xExmdWxQcwbWAHl3dHdClqK+hBfb1bwqoLrZN3c6NW2adviExP80oyOQ1heI+ABzcxhvo8zD8FO7D bNfBQSkJdbU3ZqDEpHo4I2cH0K4+lDswGksMkm2z7dj5QRWSElTt7LHBvSUrgzqJTVE7vyn873Uj0 QaYZa78T2p5YcIzkuWaQxgbd0GSgTZjpuord5slIhSthb1Qf+6x8ooS64k2gpj5qIi7TpqLnWPfQq dm5naNVbLqQUARjAswcyraTNVgigsj4O5Q6ziXtcalTV7ucLyHu3d1tibbvARRdMPf6BlczMkFoR8 O35Ugx1NMtPv0eF5lzqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPTJ-0007KB-L3; Mon, 26 Nov 2018 22:35:17 +0000 Received: from mail1.windriver.com ([147.11.146.13]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPSs-00068f-7r for linux-arm-kernel@lists.infradead.org; Mon, 26 Nov 2018 22:34:59 +0000 Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id wAQMYUI7015339 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 26 Nov 2018 14:34:30 -0800 (PST) Received: from yow-cube1.wrs.com (128.224.56.98) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 14:34:30 -0800 From: Paul Gortmaker To: Joerg Roedel Subject: [PATCH 9/9] iommu: arm-smmu-v3: make it explicitly non-modular Date: Mon, 26 Nov 2018 17:31:38 -0500 Message-ID: <1543271498-28966-10-git-send-email-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543271498-28966-1-git-send-email-paul.gortmaker@windriver.com> References: <1543271498-28966-1-git-send-email-paul.gortmaker@windriver.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181126_143450_424167_729293A2 X-CRM114-Status: GOOD ( 18.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , linux-kernel@vger.kernel.org, Paul Gortmaker , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Robin Murphy , Nate Watterson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The Kconfig currently controlling compilation of this code is: drivers/iommu/Kconfig:config ARM_SMMU_V3 drivers/iommu/Kconfig: bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit. We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, but unlike most drivers, we can't delete the function tied to the ".remove" field. This is because as of commit 7aa8619a66ae ("iommu/arm-smmu-v3: Implement shutdown method") the .remove function was given a one line wrapper and re-used to provide a .shutdown service. So we delete the wrapper and re-name the function from remove to shutdown. We add a moduleparam.h include since the file does actually declare some module parameters, and leaving them as such is the easiest way currently to remain backwards compatible with existing use cases. Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Cc: Will Deacon Cc: Joerg Roedel Cc: Robin Murphy Cc: Nate Watterson Cc: linux-arm-kernel@lists.infradead.org Cc: iommu@lists.linux-foundation.org Signed-off-by: Paul Gortmaker Acked-by: Robin Murphy --- drivers/iommu/arm-smmu-v3.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 6947ccf26512..1189c06079d4 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -20,7 +20,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -356,6 +357,10 @@ #define MSI_IOVA_BASE 0x8000000 #define MSI_IOVA_LENGTH 0x100000 +/* + * not really modular, but the easiest way to keep compat with existing + * bootargs behaviour is to continue using module_param_named here. + */ static bool disable_bypass = 1; module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); MODULE_PARM_DESC(disable_bypass, @@ -2928,37 +2933,25 @@ static int arm_smmu_device_probe(struct platform_device *pdev) return 0; } -static int arm_smmu_device_remove(struct platform_device *pdev) +static void arm_smmu_device_shutdown(struct platform_device *pdev) { struct arm_smmu_device *smmu = platform_get_drvdata(pdev); arm_smmu_device_disable(smmu); - - return 0; -} - -static void arm_smmu_device_shutdown(struct platform_device *pdev) -{ - arm_smmu_device_remove(pdev); } static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v3", }, { }, }; -MODULE_DEVICE_TABLE(of, arm_smmu_of_match); static struct platform_driver arm_smmu_driver = { .driver = { .name = "arm-smmu-v3", .of_match_table = of_match_ptr(arm_smmu_of_match), + .suppress_bind_attrs = true, }, .probe = arm_smmu_device_probe, - .remove = arm_smmu_device_remove, .shutdown = arm_smmu_device_shutdown, }; -module_platform_driver(arm_smmu_driver); - -MODULE_DESCRIPTION("IOMMU API for ARM architected SMMUv3 implementations"); -MODULE_AUTHOR("Will Deacon "); -MODULE_LICENSE("GPL v2"); +builtin_platform_driver(arm_smmu_driver);