Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1469711 > unrolled thread

[PATCH 0/9] PCI: final demodularization of non-modular code

Started byPaul Gortmaker <paul.gortmaker@windriver.com>
First post2016-08-24 23:00 +0200
Last post2016-08-25 00:40 +0200
Articles 8 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/9] PCI: final demodularization of non-modular code Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-08-24 23:00 +0200
    [PATCH 8/9] PCI: hotplug_core: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-08-24 23:00 +0200
    [PATCH 9/9] PCI: hotplug: make PCIe core code explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-08-24 23:00 +0200
    [PATCH 7/9] PCI: PCIe xilinx-nwl: make host code explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-08-24 23:00 +0200
    [PATCH 3/9] PCI: PCIe aerdrv: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-08-24 23:10 +0200
    [PATCH 2/9] PCI: PCIe pme: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-08-24 23:10 +0200
    [PATCH 1/9] PCI: PCIe dpc: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-08-24 23:10 +0200
    Re: [PATCH 0/9] PCI: final demodularization of non-modular code Bjorn Helgaas <helgaas@kernel.org> - 2016-08-25 00:40 +0200

#1469711 — [PATCH 0/9] PCI: final demodularization of non-modular code

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-08-24 23:00 +0200
Subject[PATCH 0/9] PCI: final demodularization of non-modular code
Message-ID<s9Nrc-7Bg-5@gated-at.bofh.it>
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.
---

Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: kristen.c.accardi@intel.com
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Scott Murray <scott@spiteful.org>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
Cc: Tom Long Nguyen <tom.l.nguyen@intel.com>
Cc: linux-omap@vger.kernel.org
Cc: linux-pci@vger.kernel.org

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(-)

-- 
2.8.4

[toc] | [next] | [standalone]


#1469714 — [PATCH 8/9] PCI: hotplug_core: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-08-24 23:00 +0200
Subject[PATCH 8/9] PCI: hotplug_core: make it explicitly non-modular
Message-ID<s9Nrc-7Bg-19@gated-at.bofh.it>
In reply to#1469711
The 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_PCI
drivers/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.

Cc: Scott Murray <scott@spiteful.org>
Cc: kristen.c.accardi@intel.com
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
index 555bcde3b196..60e66e027ebc 100644
--- a/drivers/pci/hotplug/cpci_hotplug.h
+++ b/drivers/pci/hotplug/cpci_hotplug.h
@@ -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 */
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index 7d3866c47312..7ec8a8f72c69 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -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);
-}
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index 9acd1997c6fe..fea0b8b33589 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -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");
-- 
2.8.4

[toc] | [prev] | [next] | [standalone]


#1469715 — [PATCH 9/9] PCI: hotplug: make PCIe core code explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-08-24 23:00 +0200
Subject[PATCH 9/9] PCI: hotplug: make PCIe core code explicitly non-modular
Message-ID<s9Nrc-7Bg-13@gated-at.bofh.it>
In reply to#1469711
The 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_PCIE
drivers/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.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: kristen.c.accardi@intel.com
Cc: linux-pci@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pci/hotplug/pciehp_core.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index ac531e674a05..fb0f86335158 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -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 <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
 #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);
-- 
2.8.4

[toc] | [prev] | [next] | [standalone]


#1469716 — [PATCH 7/9] PCI: PCIe xilinx-nwl: make host code explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-08-24 23:00 +0200
Subject[PATCH 7/9] PCI: PCIe xilinx-nwl: make host code explicitly non-modular
Message-ID<s9Nrc-7Bg-21@gated-at.bofh.it>
In reply to#1469711
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCIE_XILINX_NWL
drivers/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.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Cc: linux-pci@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pci/host/pcie-xilinx-nwl.c | 53 +++-----------------------------------
 1 file changed, 3 insertions(+), 50 deletions(-)

diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
index 0b597d9190b4..df7fb8b69658 100644
--- a/drivers/pci/host/pcie-xilinx-nwl.c
+++ b/drivers/pci/host/pcie-xilinx-nwl.c
@@ -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);
-- 
2.8.4

[toc] | [prev] | [next] | [standalone]


#1469717 — [PATCH 3/9] PCI: PCIe aerdrv: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-08-24 23:10 +0200
Subject[PATCH 3/9] PCI: PCIe aerdrv: make it explicitly non-modular
Message-ID<s9NAR-7TC-1@gated-at.bofh.it>
In reply to#1469711
The 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 PCIEAER
drivers/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.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Tom Long Nguyen <tom.l.nguyen@intel.com>
Cc: linux-pci@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pci/pcie/aer/aerdrv.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index 48d21e0edd56..49805a48b81c 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -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 "tom.l.nguyen@intel.com"
 #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);
-- 
2.8.4

[toc] | [prev] | [next] | [standalone]


#1469719 — [PATCH 2/9] PCI: PCIe pme: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-08-24 23:10 +0200
Subject[PATCH 2/9] PCI: PCIe pme: make it explicitly non-modular
Message-ID<s9NAR-7TC-7@gated-at.bofh.it>
In reply to#1469711
The 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.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pci/pcie/pme.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
index 1ae4c73e7a3c..884bad5320f8 100644
--- a/drivers/pci/pcie/pme.c
+++ b/drivers/pci/pcie/pme.c
@@ -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);
-- 
2.8.4

[toc] | [prev] | [next] | [standalone]


#1469723 — [PATCH 1/9] PCI: PCIe dpc: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-08-24 23:10 +0200
Subject[PATCH 1/9] PCI: PCIe dpc: make it explicitly non-modular
Message-ID<s9NAS-7TC-19@gated-at.bofh.it>
In reply to#1469711
The Kconfig currently controlling compilation of this code is:

drivers/pci/pcie/Kconfig:config PCIE_DPC
drivers/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.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-pci@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pci/pcie/pcie-dpc.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/pcie/pcie-dpc.c b/drivers/pci/pcie/pcie-dpc.c
index 250f87861786..9811b14d9ad8 100644
--- a/drivers/pci/pcie/pcie-dpc.c
+++ b/drivers/pci/pcie/pcie-dpc.c
@@ -1,5 +1,7 @@
 /*
  * PCI Express Downstream Port Containment services driver
+ * Author: Keith Busch <keith.busch@intel.com>
+ *
  * 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 <keith.busch@intel.com>");
-MODULE_LICENSE("GPL");
-MODULE_VERSION("0.1");
-
-module_init(dpc_service_init);
-module_exit(dpc_service_exit);
+device_initcall(dpc_service_init);
-- 
2.8.4

[toc] | [prev] | [next] | [standalone]


#1469767

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-08-25 00:40 +0200
Message-ID<s9OZX-yy-7@gated-at.bofh.it>
In reply to#1469711
On Wed, Aug 24, 2016 at 04:57:43PM -0400, Paul Gortmaker wrote:
> 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.
> ---
> 
> Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Keith Busch <keith.busch@intel.com>
> Cc: Kishon Vijay Abraham I <kishon@ti.com>
> Cc: kristen.c.accardi@intel.com
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Scott Murray <scott@spiteful.org>
> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
> Cc: Stanimir Varbanov <svarbanov@mm-sol.com>
> Cc: Tom Long Nguyen <tom.l.nguyen@intel.com>
> Cc: linux-omap@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
> 
> 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(-)

Applied to pci/demodularize for v4.9, thanks a lot, Paul!

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web