PCI: final demodularization of non-modular code
Subsystems (3)
cover PCI: final demodularization of non-modular code
This final (assuming more new instances don't leak back in) series ensures all the PCI code out there that remains using module.h is actually modular or containing some use of modular infrastructure.
These last commits are slightly more involved than some of the earlier ones since we are actually removing orphaned __exit functions and some ".remove" functions as well. So we can't claim binary equivalence here, but the overall runtime should remain unchanged.
To that end, we have remained with the existing initcall levels even though some of the hotplug infrastructural ones might make better sense to be listed as subsys_initcall or similar.
Build tested with allmodconfig on all the major architectures.
Paul.
---
Paul Gortmaker (9):
PCI: PCIe dpc: make it explicitly non-modular
PCI: PCIe pme: make it explicitly non-modular
PCI: PCIe aerdrv: make it explicitly non-modular
PCI: dra7xx: make host code explicitly non-modular
PCI: PCIe qcom: make host code explicitly non-modular
PCI: PCIe xilinx: make host code explicitly non-modular
PCI: PCIe xilinx-nwl: make host code explicitly non-modular
PCI: hotplug_core: make it explicitly non-modular
PCI: hotplug: make PCIe core code explicitly non-modular
drivers/pci/host/pci-dra7xx.c | 31 ++----------------- drivers/pci/host/pcie-qcom.c | 28 +++++------------ drivers/pci/host/pcie-xilinx-nwl.c | 53 ++------------------------------- drivers/pci/host/pcie-xilinx.c | 53 ++------------------------------- drivers/pci/hotplug/cpci_hotplug.h | 2 -- drivers/pci/hotplug/cpci_hotplug_core.c | 10 ------- drivers/pci/hotplug/pci_hotplug_core.c | 18 ++++------- drivers/pci/hotplug/pciehp_core.c | 20 ++++--------- drivers/pci/pcie/aer/aerdrv.c | 18 +---------- drivers/pci/pcie/pcie-dpc.c | 18 +++-------- drivers/pci/pcie/pme.c | 16 +--------- 11 files changed, 32 insertions(+), 235 deletions(-)
Signature · 1 line
2.8.4
PATCH 1/9 PCI: PCIe dpc: make it explicitly non-modular
The Kconfig currently controlling compilation of this code is:
drivers/pci/pcie/Kconfig:config PCIE_DPCdrivers/pci/pcie/Kconfig: bool "PCIe Downstream Port Containment 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_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
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.
--- drivers/pci/pcie/pcie-dpc.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/pci/pcie/pcie-dpc.c +4 -14
@@ -1,5 +1,7 @@/* * PCI Express Downstream Port Containment services driver +* Author: Keith Busch <[email protected]> +* * Copyright (C) 2016 Intel Corp. * * This file is subject to the terms and conditions of the GNU General Public
@@ -9,7 +11,7 @@#include <linux/delay.h> #include <linux/interrupt.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/pci.h> #include <linux/pcieport_if.h>
@@ -143,16 +145,4 @@ static int __init dpc_service_init(void) {return pcie_port_service_register (&dpcdriver); } - -static void __exit dpc_service_exit(void) -{ -pcie_port_service_unregister (&dpcdriver); -} - -MODULE_DESCRIPTION ("PCI Express Downstream Port Containment driver" ); -MODULE_AUTHOR ("Keith Busch <[email protected]>" ); -MODULE_LICENSE ("GPL" ); -MODULE_VERSION ("0.1" ); - -module_init (dpc_service_init); -module_exit (dpc_service_exit); +device_initcall (dpc_service_init);
Signature · 1 line
2.8.4
PATCH 2/9 PCI: PCIe pme: make it explicitly non-modular
In reply to Paul GortmakerThe Kconfig for this option is currently:
config PCIE_PME
def_bool y
depends on PCIEPORTBUS && PM...where both dependencies are also bool items. That means it currently
is not being built as a module by anyone. Lets remove all traces of
modularity, so that when reading the code, there is no doubt it is builtin-only.
As part of that, we delete the .remove function, since that doesn't seem to have a sensible use case. With "normal" endpoint drivers, we have in the past set the suppress_bind_attrs bit to make it clear that the use of ".remove" in a built-in driver was deleted, but here for PCI, it would seem to be overkill to jump through the pcie_port_service_driver and into the struct device_driver in order to finally try and do something similar with the bind setting.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
We don't exchange module.h for init.h since this file already has it.
--- drivers/pci/pcie/pme.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/pci/pcie/pme.c +1 -15
@@ -10,7 +10,6 @@* for more details. */ -#include <linux/module.h> #include <linux/pci.h> #include <linux/kernel.h> #include <linux/errno.h>
@@ -449,17 +448,6 @@ static int pcie_pme_resume(struct pcie_device *srv)return 0 ; } -/** -* pcie_pme_remove - Prepare PCIe PME service device for removal. -* @srv - PCIe service device to remove. -*/ -static void pcie_pme_remove (struct pcie_device *srv) -{ -pcie_pme_suspend (srv); -free_irq (srv->irq, srv); -kfree (get_service_data (srv)); -} -static struct pcie_port_service_driver pcie_pme_driver = { .name ="pcie_pme" , .port_type =PCI_EXP_TYPE_ROOT_PORT ,
@@ -468,7 +456,6 @@ static struct pcie_port_service_driver pcie_pme_driver = { .probe = pcie_pme_probe, .suspend = pcie_pme_suspend, .resume = pcie_pme_resume, - .remove = pcie_pme_remove, };/**
@@ -478,5 +465,4 @@ static int __init pcie_pme_service_init(void) {return pcie_port_service_register (&pcie_pme_driver); } - -module_init (pcie_pme_service_init); +device_initcall (pcie_pme_service_init);
Signature · 1 line
2.8.4
PATCH 3/9 PCI: PCIe aerdrv: make it explicitly non-modular
In reply to Paul GortmakerThe Makefile fragments currently controlling compilation of this code are:
obj-$(CONFIG_PCIEAER) += aerdriver.o aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o
The Kconfig currently controlling compilation of this code is:
drivers/pci/pcie/aer/Kconfig:config PCIEAERdrivers/pci/pcie/aer/Kconfig: bool "Root Port Advanced Error Reporting 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_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
We don't replace module.h with init.h since the file already has that.
We also delete the MODULE_LICENSE tag etc since all that information is already contained earlier in the file.
--- drivers/pci/pcie/aer/aerdrv.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/pci/pcie/aer/aerdrv.c +1 -17
@@ -15,7 +15,6 @@* */ -#include <linux/module.h> #include <linux/pci.h> #include <linux/pci-acpi.h> #include <linux/sched.h>
@@ -37,9 +36,6 @@#define DRIVER_VERSION "v1.0"#define DRIVER_AUTHOR "[email protected]"#define DRIVER_DESC "Root Port Advanced Error Reporting Driver" -MODULE_AUTHOR (DRIVER_AUTHOR ); -MODULE_DESCRIPTION (DRIVER_DESC ); -MODULE_LICENSE ("GPL" );static int aer_probe (struct pcie_device *dev);static void aer_remove (struct pcie_device *dev);
@@ -417,16 +413,4 @@ static int __init aer_service_init(void)return -ENXIO ;return pcie_port_service_register (&aerdriver); } - -/** -* aer_service_exit - unregister AER root service driver -* -* Invoked when AER root service driver is unloaded. -*/ -static void __exit aer_service_exit(void) -{ -pcie_port_service_unregister (&aerdriver); -} - -module_init (aer_service_init); -module_exit (aer_service_exit); +device_initcall (aer_service_init);
Signature · 1 line
2.8.4
PATCH 4/9 PCI: dra7xx: make host code explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/pci/host/Kconfig:config PCI_DRA7XXdrivers/pci/host/Kconfig: bool "TI DRA7xx PCIe controller"
...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.
We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() 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 is already contained at the top of the file in the comments.
--- drivers/pci/host/pci-dra7xx.c | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-)
drivers/pci/host/pci-dra7xx.c +3 -28
@@ -15,7 +15,7 @@#include <linux/irq.h> #include <linux/irqdomain.h> #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_gpio.h> #include <linux/pci.h> #include <linux/phy/phy.h>
@@ -443,25 +443,6 @@ err_phy:return ret; } -static int __exit dra7xx_pcie_remove(struct platform_device *pdev) -{ -struct dra7xx_pcie *dra7xx =platform_get_drvdata (pdev); -struct pcie_port *pp = &dra7xx->pp; -struct device *dev = &pdev->dev; -int count = dra7xx->phy_count; - -if (pp->irq_domain) -irq_domain_remove (pp->irq_domain); -pm_runtime_put (dev); -pm_runtime_disable (dev); -while (count--) { -phy_power_off (dra7xx->phy[count]); -phy_exit (dra7xx->phy[count]); - } - -return 0 ; -} -#ifdef CONFIG_PM_SLEEP static int dra7xx_pcie_suspend (struct device *dev) {
@@ -545,19 +526,13 @@ static const struct of_device_id of_dra7xx_pcie_match[] = { { .compatible = "ti,dra7-pcie", }, {}, }; -MODULE_DEVICE_TABLE (of, of_dra7xx_pcie_match);static struct platform_driver dra7xx_pcie_driver = { - .remove =__exit_p (dra7xx_pcie_remove), .driver = { .name ="dra7-pcie" , .of_match_table = of_dra7xx_pcie_match, + .suppress_bind_attrs = true, .pm = &dra7xx_pcie_pm_ops, }, }; - -module_platform_driver_probe (dra7xx_pcie_driver, dra7xx_pcie_probe); - -MODULE_AUTHOR ("Kishon Vijay Abraham I <[email protected]>" ); -MODULE_DESCRIPTION ("TI PCIe controller driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver_probe (dra7xx_pcie_driver, dra7xx_pcie_probe);
Signature · 1 line
2.8.4
PATCH 5/9 PCI: PCIe qcom: make host code explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/pci/host/Kconfig:config PCIE_QCOMdrivers/pci/host/Kconfig: bool "Qualcomm PCIe controller"
...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.
We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() 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.
--- drivers/pci/host/pcie-qcom.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/pci/host/pcie-qcom.c +7 -21
@@ -1,7 +1,11 @@/* +* Qualcomm PCIe root complex driver +* * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. * Copyright 2015 Linaro Limited. * +* Author: Stanimir Varbanov <[email protected]> +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation.
@@ -19,7 +23,7 @@#include <linux/io.h> #include <linux/iopoll.h> #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_device.h> #include <linux/of_gpio.h> #include <linux/pci.h>
@@ -570,37 +574,19 @@ static int qcom_pcie_probe(struct platform_device *pdev)return 0 ; } -static int qcom_pcie_remove (struct platform_device *pdev) -{ -struct qcom_pcie *pcie =platform_get_drvdata (pdev); - -qcom_ep_reset_assert (pcie); -phy_power_off (pcie->phy); -phy_exit (pcie->phy); - pcie->ops->deinit (pcie); - -return 0 ; -} -static const struct of_device_id qcom_pcie_match[] = { { .compatible ="qcom,pcie-ipq8064" , .data = &ops_v0 }, { .compatible ="qcom,pcie-apq8064" , .data = &ops_v0 }, { .compatible ="qcom,pcie-apq8084" , .data = &ops_v1 }, { } }; -MODULE_DEVICE_TABLE (of, qcom_pcie_match);static struct platform_driver qcom_pcie_driver = { .probe = qcom_pcie_probe, - .remove = qcom_pcie_remove, .driver = { .name ="qcom-pcie" , + .suppress_bind_attrs = true, .of_match_table = qcom_pcie_match, }, }; - -module_platform_driver (qcom_pcie_driver); - -MODULE_AUTHOR ("Stanimir Varbanov <[email protected]>" ); -MODULE_DESCRIPTION ("Qualcomm PCIe root complex driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver (qcom_pcie_driver);
Signature · 1 line
2.8.4
PATCH 6/9 PCI: PCIe xilinx: make host code explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/pci/host/Kconfig:config PCIE_XILINXdrivers/pci/host/Kconfig: bool "Xilinx AXI PCIe host bridge 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. This makes xilinx_pcie_free_irq_domain orphaned so we remove it too.
We don't have to worry about disallowing a driver unbind, since this driver already does that.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.
--- drivers/pci/host/pcie-xilinx.c | 53 ++---------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-)
drivers/pci/host/pcie-xilinx.c +2 -51
@@ -18,7 +18,7 @@#include <linux/irq.h> #include <linux/irqdomain.h> #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/msi.h> #include <linux/of_address.h> #include <linux/of_pci.h>
@@ -506,35 +506,6 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data) }/** -* xilinx_pcie_free_irq_domain - Free IRQ domain -* @port: PCIe port information -*/ -static void xilinx_pcie_free_irq_domain (struct xilinx_pcie_port *port) -{ -int i; -u32 irq, num_irqs; - -/* Free IRQ Domain */ -if (IS_ENABLED (CONFIG_PCI_MSI )) { - -free_pages (port->msi_pages,0 ); - - num_irqs =XILINX_NUM_MSI_IRQS ; - }else { -/* INTx */ - num_irqs =4 ; - } - -for (i =0 ; i < num_irqs; i++) { - irq =irq_find_mapping (port->irq_domain, i); -if (irq >0 ) -irq_dispose_mapping (irq); - } - -irq_domain_remove (port->irq_domain); -} - -/** * xilinx_pcie_init_irq_domain - Initialize IRQ domain * @port: PCIe port information *
@@ -724,21 +695,6 @@ error:return err; } -/** -* xilinx_pcie_remove - Remove function -* @pdev: Platform device pointer -* -* Return: '0' always -*/ -static int xilinx_pcie_remove (struct platform_device *pdev) -{ -struct xilinx_pcie_port *port =platform_get_drvdata (pdev); - -xilinx_pcie_free_irq_domain (port); - -return 0 ; -} -static struct of_device_id xilinx_pcie_of_match[] = { { .compatible ="xlnx,axi-pcie-host-1.00.a" , }, {}
@@ -751,10 +707,5 @@ static struct platform_driver xilinx_pcie_driver = { .suppress_bind_attrs = true, }, .probe = xilinx_pcie_probe, - .remove = xilinx_pcie_remove, }; -module_platform_driver (xilinx_pcie_driver); - -MODULE_AUTHOR ("Xilinx Inc" ); -MODULE_DESCRIPTION ("Xilinx AXI PCIe driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver (xilinx_pcie_driver);
Signature · 1 line
2.8.4
PATCH 7/9 PCI: PCIe xilinx-nwl: make host code explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/pci/host/Kconfig:config PCIE_XILINX_NWLdrivers/pci/host/Kconfig: bool "NWL PCIe Core"
...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.
We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers. Several functions only used by the remove function are also deleted here.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.
--- drivers/pci/host/pcie-xilinx-nwl.c | 53 +++----------------------------------- 1 file changed, 3 insertions(+), 50 deletions(-)
drivers/pci/host/pcie-xilinx-nwl.c +3 -50
@@ -15,7 +15,7 @@#include <linux/irq.h> #include <linux/irqdomain.h> #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/msi.h> #include <linux/of_address.h> #include <linux/of_pci.h>
@@ -459,40 +459,6 @@ static const struct irq_domain_ops dev_msi_domain_ops = { .free = nwl_irq_domain_free, }; -static void nwl_msi_free_irq_domain (struct nwl_pcie *pcie) -{ -struct nwl_msi *msi = &pcie->msi; - -if (msi->irq_msi0) -irq_set_chained_handler_and_data (msi->irq_msi0,NULL ,NULL ); -if (msi->irq_msi1) -irq_set_chained_handler_and_data (msi->irq_msi1,NULL ,NULL ); - -if (msi->msi_domain) -irq_domain_remove (msi->msi_domain); -if (msi->dev_domain) -irq_domain_remove (msi->dev_domain); - -kfree (msi->bitmap); - msi->bitmap =NULL ; -} - -static void nwl_pcie_free_irq_domain (struct nwl_pcie *pcie) -{ -int i; -u32 irq; - -for (i =0 ; i <INTX_NUM ; i++) { - irq =irq_find_mapping (pcie->legacy_irq_domain, i +1 ); -if (irq >0 ) -irq_dispose_mapping (irq); - } -if (pcie->legacy_irq_domain) -irq_domain_remove (pcie->legacy_irq_domain); - -nwl_msi_free_irq_domain (pcie); -} -static int nwl_pcie_init_msi_irq_domain (struct nwl_pcie *pcie) {#ifdef CONFIG_PCI_MSI
@@ -867,25 +833,12 @@ error:return err; } -static int nwl_pcie_remove (struct platform_device *pdev) -{ -struct nwl_pcie *pcie =platform_get_drvdata (pdev); - -nwl_pcie_free_irq_domain (pcie); -platform_set_drvdata (pdev,NULL ); -return 0 ; -} -static struct platform_driver nwl_pcie_driver = { .driver = { .name ="nwl-pcie" , + .suppress_bind_attrs = true, .of_match_table = nwl_pcie_of_match, }, .probe = nwl_pcie_probe, - .remove = nwl_pcie_remove, }; -module_platform_driver (nwl_pcie_driver); - -MODULE_AUTHOR ("Xilinx, Inc" ); -MODULE_DESCRIPTION ("NWL PCIe driver" ); -MODULE_LICENSE ("GPL" ); +builtin_platform_driver (nwl_pcie_driver);
Signature · 1 line
2.8.4
PATCH 8/9 PCI: hotplug_core: make it explicitly non-modular
In reply to Paul GortmakerThe Makefile bits currently controlling compilation of this code are:
obj-$(CONFIG_HOTPLUG_PCI) += pci_hotplug.o
[...]
pci_hotplug-objs := pci_hotplug_core.o
and the Kconfig is:
drivers/pci/hotplug/Kconfig:menuconfig HOTPLUG_PCIdrivers/pci/hotplug/Kconfig: bool "Support for PCI Hotplug"
...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.
This makes an exit function in cpci_hotplug_core.c orphaned, so we remove it here at the same time.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. However one could argue that we should use subsys_initcall() here, but for now we stick with runtime equivalence.
We would delete module.h and just keep the moduleparam.h include (since the file does use module_param), but there is a try_module_get and module_put pairing that prevents us from doing that.
We also delete the MODULE_LICENSE tag etc since all that information is already contained higher up in the file.
--- drivers/pci/hotplug/cpci_hotplug.h | 2 -- drivers/pci/hotplug/cpci_hotplug_core.c | 10 ---------- drivers/pci/hotplug/pci_hotplug_core.c | 18 ++++++------------ 3 files changed, 6 insertions(+), 24 deletions(-)
drivers/pci/hotplug/cpci_hotplug.h +0 -2
@@ -101,10 +101,8 @@ int cpci_unconfigure_slot(struct slot *slot);#ifdef CONFIG_HOTPLUG_PCI_CPCI int cpci_hotplug_init (int debug); -void cpci_hotplug_exit (void );#else static inline int cpci_hotplug_init (int debug) {return 0 ; } -static inline void cpci_hotplug_exit (void ) { }#endif #endif /* _CPCI_HOTPLUG_H */
drivers/pci/hotplug/cpci_hotplug_core.c +0 -10
@@ -719,13 +719,3 @@ cpci_hotplug_init(int debug) cpci_debug = debug;return 0 ; } - -void __exit -cpci_hotplug_exit (void ) -{ -/* -* Clean everything up. -*/ -cpci_hp_stop (); -cpci_hp_unregister_controller (controller); -}
drivers/pci/hotplug/pci_hotplug_core.c +6 -12
@@ -25,7 +25,7 @@* */ -#include <linux/module.h> +#include <linux/module.h> /* try_module_get & module_put */ #include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/types.h>
@@ -537,17 +537,11 @@ static int __init pci_hotplug_init(void)info (DRIVER_DESC " version: " DRIVER_VERSION "\n" );return result; } +device_initcall (pci_hotplug_init); -static void __exit pci_hotplug_exit(void) -{ -cpci_hotplug_exit (); -} - -module_init (pci_hotplug_init); -module_exit (pci_hotplug_exit); - -MODULE_AUTHOR (DRIVER_AUTHOR ); -MODULE_DESCRIPTION (DRIVER_DESC ); -MODULE_LICENSE ("GPL" ); +/* +* not really modular, but the easiest way to keep compat with existing +* bootargs behaviour is to continue using module_param here. +*/ module_param (debug, bool,0644 );MODULE_PARM_DESC (debug,"Debugging mode enabled or not" );
Signature · 1 line
2.8.4
PATCH 9/9 PCI: hotplug: make PCIe core code explicitly non-modular
In reply to Paul GortmakerThe Makefile fragments currently controlling compilation of this code are:
obj-$(CONFIG_HOTPLUG_PCI_PCIE) += pciehp.o
[...]
pciehp-objs := pciehp_core.o \
The Kconfig currently controlling compilation of this code is:
drivers/pci/pcie/Kconfig:config HOTPLUG_PCI_PCIEdrivers/pci/pcie/Kconfig: bool "PCI Express Hotplug driver"
...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_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. However one could argue that we should use subsys_initcall() here, but for now we stick with runtime equivalence.
We delete module.h but we keep the moduleparam.h include, since we are keeping the module_param() that the file has as-is for now.
We also delete the MODULE_LICENSE tag etc since all that information is still contained higher up in the file via the DEFINE lines which now serve as documentation only.
--- drivers/pci/hotplug/pciehp_core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/pci/hotplug/pciehp_core.c +5 -15
@@ -27,7 +27,6 @@* */ -#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/slab.h>
@@ -47,10 +46,10 @@ static bool pciehp_force;#define DRIVER_AUTHOR "Dan Zink <[email protected]>, Greg Kroah-Hartman <[email protected]>, Dely Sy <[email protected]>"#define DRIVER_DESC "PCI Express Hot Plug Controller Driver" -MODULE_AUTHOR (DRIVER_AUTHOR ); -MODULE_DESCRIPTION (DRIVER_DESC ); -MODULE_LICENSE ("GPL" ); - +/* +* not really modular, but the easiest way to keep compat with existing +* bootargs behaviour is to continue using module_param here. +*/ module_param (pciehp_debug, bool,0644 );module_param (pciehp_poll_mode, bool,0644 );module_param (pciehp_poll_time, int,0644 );
@@ -337,13 +336,4 @@ static int __init pcied_init(void)return retval; } - -static void __exit pcied_cleanup(void) -{ -dbg ("unload_pciehpd()\n" ); -pcie_port_service_unregister (&hpdriver_portdrv); -info (DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n" ); -} - -module_init (pcied_init); -module_exit (pcied_cleanup); +device_initcall (pcied_init);
Signature · 1 line
2.8.4
Bjorn Helgaas
AppliedQuoted 44 lines · Paul Gortmaker
This final (assuming more new instances don't leak back in) series ensures all the PCI code out there that remains using
module.his actually modular or containing some use of modular infrastructure.These last commits are slightly more involved than some of the earlier ones since we are actually removing orphaned
__exitfunctions and some ".remove" functions as well. So we can't claim binary equivalence here, but the overall runtime should remain unchanged.To that end, we have remained with the existing initcall levels even though some of the hotplug infrastructural ones might make better sense to be listed as
subsys_initcallor similar.Build tested with allmodconfig on all the major architectures.
Paul.
---Cc Bharat Kumar Gogada <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Keith Busch <[email protected]>Cc Kishon Vijay Abraham I <[email protected]>Cc Marc Zyngier <[email protected]>Cc Michal Simek <[email protected]>Cc Mika Westerberg <[email protected]>Cc Scott Murray <[email protected]>Cc "Sören Brinkmann" <[email protected]>Cc Stanimir Varbanov <[email protected]>Cc Tom Long Nguyen <[email protected]>Paul Gortmaker (9):
PCI: PCIe dpc: make it explicitly non-modular
PCI: PCIe pme: make it explicitly non-modular
PCI: PCIe aerdrv: make it explicitly non-modular
PCI: dra7xx: make host code explicitly non-modular
PCI: PCIe qcom: make host code explicitly non-modular
PCI: PCIe xilinx: make host code explicitly non-modular
PCI: PCIe xilinx-nwl: make host code explicitly non-modular
PCI:hotplug_core: make it explicitly non-modular
PCI: hotplug: make PCIe core code explicitly non-modular
Quoted 12 lines
drivers/pci/host/pci-dra7xx.c | 31 ++----------------- drivers/pci/host/pcie-qcom.c | 28 +++++------------ drivers/pci/host/pcie-xilinx-nwl.c | 53 ++------------------------------- drivers/pci/host/pcie-xilinx.c | 53 ++------------------------------- drivers/pci/hotplug/cpci_hotplug.h | 2 -- drivers/pci/hotplug/cpci_hotplug_core.c | 10 ------- drivers/pci/hotplug/pci_hotplug_core.c | 18 ++++------- drivers/pci/hotplug/pciehp_core.c | 20 ++++--------- drivers/pci/pcie/aer/aerdrv.c | 18 +---------- drivers/pci/pcie/pcie-dpc.c | 18 +++-------- drivers/pci/pcie/pme.c | 16 +--------- 11 files changed, 32 insertions(+), 235 deletions(-)
Applied to pci/demodularize for v4.9, thanks a lot, Paul!