linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] PCI: Modularize host-generic
@ 2020-04-09 23:49 Rob Herring
  2020-04-09 23:49 ` [PATCH 1/3] PCI: Constify struct pci_ecam_ops Rob Herring
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Rob Herring @ 2020-04-09 23:49 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Will Deacon
  Cc: Andrew Murray, Catalin Marinas, Mans Rullgard, Marc Gonzalez,
	Robert Richter, Zhou Wang, Toan Le, Rafael J. Wysocki, Len Brown,
	Jonathan Chocron, linux-acpi, linux-arm-kernel, linux-pci

This is part of a larger effort to modularize ARCH_VEXPRESS. In
particular, the Arm FVP platforms use the host-generic driver. This
conversion was straight-forward. I didn't convert the other ECAM drivers
using host-common to modules, but am happy to do so if there's a strong
desire to do so.

In the process, I noticed that 'const' was being dropped from the match
table .data pointer, so the first patch constifies struct pci_ecam_ops.
I started trying to constify pci_ops too, but that became a never ending
treewide rabbit hole. So I ended up with a cast when we assign pci_ops
from pci_ecam_ops.

Rob


Rob Herring (3):
  PCI: Constify struct pci_ecam_ops
  PCI: host-generic: Support building as modules
  PCI: host-generic: Eliminate pci_host_common_probe wrappers

 arch/arm64/kernel/pci.c                   |  4 ++--
 drivers/acpi/pci_mcfg.c                   |  8 +++----
 drivers/pci/controller/Kconfig            |  4 ++--
 drivers/pci/controller/dwc/pcie-al.c      |  2 +-
 drivers/pci/controller/dwc/pcie-hisi.c    | 19 +++++------------
 drivers/pci/controller/pci-host-common.c  | 18 ++++++++++++----
 drivers/pci/controller/pci-host-generic.c | 26 +++++++----------------
 drivers/pci/controller/pci-thunder-ecam.c | 14 ++++++------
 drivers/pci/controller/pci-thunder-pem.c  | 16 ++++++--------
 drivers/pci/controller/pci-xgene.c        |  4 ++--
 drivers/pci/controller/pcie-tango.c       |  9 +++++---
 drivers/pci/ecam.c                        | 10 ++++++---
 drivers/pci/setup-bus.c                   |  1 +
 include/linux/pci-acpi.h                  |  2 +-
 include/linux/pci-ecam.h                  | 25 +++++++++++-----------
 15 files changed, 78 insertions(+), 84 deletions(-)

--
2.20.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] PCI: Constify struct pci_ecam_ops
  2020-04-09 23:49 [PATCH 0/3] PCI: Modularize host-generic Rob Herring
@ 2020-04-09 23:49 ` Rob Herring
  2020-04-14 10:22   ` Catalin Marinas
  2020-04-09 23:49 ` [PATCH 2/3] PCI: host-generic: Support building as modules Rob Herring
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2020-04-09 23:49 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Will Deacon
  Cc: Andrew Murray, Catalin Marinas, Mans Rullgard, Marc Gonzalez,
	Robert Richter, Zhou Wang, Toan Le, Rafael J. Wysocki, Len Brown,
	Jonathan Chocron, linux-acpi, linux-arm-kernel, linux-pci

struct pci_ecam_ops is typically DT match table data which is defined to
be const. It's also best practice for ops structs to be const. Ideally,
we'd make struct pci_ops const as well, but that becomes pretty
invasive, so for now we just cast it where needed.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Andrew Murray <amurray@thegoodpenguin.co.uk>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Jonathan Chocron <jonnyc@amazon.com>
Cc: Zhou Wang <wangzhou1@hisilicon.com>
Cc: Robert Richter <rrichter@marvell.com>
Cc: Toan Le <toan@os.amperecomputing.com>
Cc: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Mans Rullgard <mans@mansr.com>
Cc: linux-acpi@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
 arch/arm64/kernel/pci.c                   |  4 ++--
 drivers/acpi/pci_mcfg.c                   |  8 ++++----
 drivers/pci/controller/dwc/pcie-al.c      |  2 +-
 drivers/pci/controller/dwc/pcie-hisi.c    |  8 ++++----
 drivers/pci/controller/pci-host-common.c  |  6 +++---
 drivers/pci/controller/pci-host-generic.c |  4 ++--
 drivers/pci/controller/pci-thunder-ecam.c |  2 +-
 drivers/pci/controller/pci-thunder-pem.c  |  4 ++--
 drivers/pci/controller/pci-xgene.c        |  4 ++--
 drivers/pci/controller/pcie-tango.c       |  2 +-
 drivers/pci/ecam.c                        |  6 +++---
 include/linux/pci-acpi.h                  |  2 +-
 include/linux/pci-ecam.h                  | 22 +++++++++++-----------
 13 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 570988c7a7ff..1006ed2d7c60 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -117,7 +117,7 @@ pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root)
 	struct device *dev = &root->device->dev;
 	struct resource *bus_res = &root->secondary;
 	u16 seg = root->segment;
-	struct pci_ecam_ops *ecam_ops;
+	const struct pci_ecam_ops *ecam_ops;
 	struct resource cfgres;
 	struct acpi_device *adev;
 	struct pci_config_window *cfg;
@@ -185,7 +185,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 
 	root_ops->release_info = pci_acpi_generic_release_info;
 	root_ops->prepare_resources = pci_acpi_root_prepare_resources;
-	root_ops->pci_ops = &ri->cfg->ops->pci_ops;
+	root_ops->pci_ops = (struct pci_ops *)&ri->cfg->ops->pci_ops;
 	bus = acpi_pci_root_create(root, root_ops, &ri->common, ri->cfg);
 	if (!bus)
 		return NULL;
diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c
index 6b347d9920cc..54b36b7ad47d 100644
--- a/drivers/acpi/pci_mcfg.c
+++ b/drivers/acpi/pci_mcfg.c
@@ -29,7 +29,7 @@ struct mcfg_fixup {
 	u32 oem_revision;
 	u16 segment;
 	struct resource bus_range;
-	struct pci_ecam_ops *ops;
+	const struct pci_ecam_ops *ops;
 	struct resource cfgres;
 };
 
@@ -165,7 +165,7 @@ static int pci_mcfg_quirk_matches(struct mcfg_fixup *f, u16 segment,
 
 static void pci_mcfg_apply_quirks(struct acpi_pci_root *root,
 				  struct resource *cfgres,
-				  struct pci_ecam_ops **ecam_ops)
+				  const struct pci_ecam_ops **ecam_ops)
 {
 #ifdef CONFIG_PCI_QUIRKS
 	u16 segment = root->segment;
@@ -191,9 +191,9 @@ static void pci_mcfg_apply_quirks(struct acpi_pci_root *root,
 static LIST_HEAD(pci_mcfg_list);
 
 int pci_mcfg_lookup(struct acpi_pci_root *root, struct resource *cfgres,
-		    struct pci_ecam_ops **ecam_ops)
+		    const struct pci_ecam_ops **ecam_ops)
 {
-	struct pci_ecam_ops *ops = &pci_generic_ecam_ops;
+	const struct pci_ecam_ops *ops = &pci_generic_ecam_ops;
 	struct resource *bus_res = &root->secondary;
 	u16 seg = root->segment;
 	struct mcfg_entry *e;
diff --git a/drivers/pci/controller/dwc/pcie-al.c b/drivers/pci/controller/dwc/pcie-al.c
index 1eeda2f6371f..270868f3859a 100644
--- a/drivers/pci/controller/dwc/pcie-al.c
+++ b/drivers/pci/controller/dwc/pcie-al.c
@@ -80,7 +80,7 @@ static int al_pcie_init(struct pci_config_window *cfg)
 	return 0;
 }
 
-struct pci_ecam_ops al_pcie_ops = {
+const struct pci_ecam_ops al_pcie_ops = {
 	.bus_shift    = 20,
 	.init         =  al_pcie_init,
 	.pci_ops      = {
diff --git a/drivers/pci/controller/dwc/pcie-hisi.c b/drivers/pci/controller/dwc/pcie-hisi.c
index 6d9e1b2b8f7b..90017045334d 100644
--- a/drivers/pci/controller/dwc/pcie-hisi.c
+++ b/drivers/pci/controller/dwc/pcie-hisi.c
@@ -104,7 +104,7 @@ static int hisi_pcie_init(struct pci_config_window *cfg)
 	return 0;
 }
 
-struct pci_ecam_ops hisi_pcie_ops = {
+const struct pci_ecam_ops hisi_pcie_ops = {
 	.bus_shift    = 20,
 	.init         =  hisi_pcie_init,
 	.pci_ops      = {
@@ -362,7 +362,7 @@ static int hisi_pcie_platform_init(struct pci_config_window *cfg)
 	return 0;
 }
 
-struct pci_ecam_ops hisi_pcie_platform_ops = {
+const struct pci_ecam_ops hisi_pcie_platform_ops = {
 	.bus_shift    = 20,
 	.init         =  hisi_pcie_platform_init,
 	.pci_ops      = {
@@ -375,11 +375,11 @@ struct pci_ecam_ops hisi_pcie_platform_ops = {
 static const struct of_device_id hisi_pcie_almost_ecam_of_match[] = {
 	{
 		.compatible =  "hisilicon,hip06-pcie-ecam",
-		.data	    = (void *) &hisi_pcie_platform_ops,
+		.data	    =  &hisi_pcie_platform_ops,
 	},
 	{
 		.compatible =  "hisilicon,hip07-pcie-ecam",
-		.data       = (void *) &hisi_pcie_platform_ops,
+		.data       =  &hisi_pcie_platform_ops,
 	},
 	{},
 };
diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index 250a3fc80ec6..f6d5dc068488 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -19,7 +19,7 @@ static void gen_pci_unmap_cfg(void *ptr)
 }
 
 static struct pci_config_window *gen_pci_init(struct device *dev,
-		struct list_head *resources, struct pci_ecam_ops *ops)
+		struct list_head *resources, const struct pci_ecam_ops *ops)
 {
 	int err;
 	struct resource cfgres;
@@ -55,7 +55,7 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
 }
 
 int pci_host_common_probe(struct platform_device *pdev,
-			  struct pci_ecam_ops *ops)
+			  const struct pci_ecam_ops *ops)
 {
 	struct device *dev = &pdev->dev;
 	struct pci_host_bridge *bridge;
@@ -82,7 +82,7 @@ int pci_host_common_probe(struct platform_device *pdev,
 	bridge->dev.parent = dev;
 	bridge->sysdata = cfg;
 	bridge->busnr = cfg->busr.start;
-	bridge->ops = &ops->pci_ops;
+	bridge->ops = (struct pci_ops *)&ops->pci_ops;
 	bridge->map_irq = of_irq_parse_and_map_pci;
 	bridge->swizzle_irq = pci_common_swizzle;
 
diff --git a/drivers/pci/controller/pci-host-generic.c b/drivers/pci/controller/pci-host-generic.c
index 75a2fb930d4b..7e9a7c0833b1 100644
--- a/drivers/pci/controller/pci-host-generic.c
+++ b/drivers/pci/controller/pci-host-generic.c
@@ -15,7 +15,7 @@
 #include <linux/pci-ecam.h>
 #include <linux/platform_device.h>
 
-static struct pci_ecam_ops gen_pci_cfg_cam_bus_ops = {
+static const struct pci_ecam_ops gen_pci_cfg_cam_bus_ops = {
 	.bus_shift	= 16,
 	.pci_ops	= {
 		.map_bus	= pci_ecam_map_bus,
@@ -49,7 +49,7 @@ static void __iomem *pci_dw_ecam_map_bus(struct pci_bus *bus,
 	return pci_ecam_map_bus(bus, devfn, where);
 }
 
-static struct pci_ecam_ops pci_dw_ecam_bus_ops = {
+static const struct pci_ecam_ops pci_dw_ecam_bus_ops = {
 	.bus_shift	= 20,
 	.pci_ops	= {
 		.map_bus	= pci_dw_ecam_map_bus,
diff --git a/drivers/pci/controller/pci-thunder-ecam.c b/drivers/pci/controller/pci-thunder-ecam.c
index 32d1d7b81ef4..c3fdd3e6b21c 100644
--- a/drivers/pci/controller/pci-thunder-ecam.c
+++ b/drivers/pci/controller/pci-thunder-ecam.c
@@ -345,7 +345,7 @@ static int thunder_ecam_config_write(struct pci_bus *bus, unsigned int devfn,
 	return pci_generic_config_write(bus, devfn, where, size, val);
 }
 
-struct pci_ecam_ops pci_thunder_ecam_ops = {
+const struct pci_ecam_ops pci_thunder_ecam_ops = {
 	.bus_shift	= 20,
 	.pci_ops	= {
 		.map_bus        = pci_ecam_map_bus,
diff --git a/drivers/pci/controller/pci-thunder-pem.c b/drivers/pci/controller/pci-thunder-pem.c
index 9491e266b1ea..2e792707ceab 100644
--- a/drivers/pci/controller/pci-thunder-pem.c
+++ b/drivers/pci/controller/pci-thunder-pem.c
@@ -403,7 +403,7 @@ static int thunder_pem_acpi_init(struct pci_config_window *cfg)
 	return thunder_pem_init(dev, cfg, res_pem);
 }
 
-struct pci_ecam_ops thunder_pem_ecam_ops = {
+const struct pci_ecam_ops thunder_pem_ecam_ops = {
 	.bus_shift	= 24,
 	.init		= thunder_pem_acpi_init,
 	.pci_ops	= {
@@ -440,7 +440,7 @@ static int thunder_pem_platform_init(struct pci_config_window *cfg)
 	return thunder_pem_init(dev, cfg, res_pem);
 }
 
-static struct pci_ecam_ops pci_thunder_pem_ops = {
+static const struct pci_ecam_ops pci_thunder_pem_ops = {
 	.bus_shift	= 24,
 	.init		= thunder_pem_platform_init,
 	.pci_ops	= {
diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index de195fd430dc..d1efa8ffbae1 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -256,7 +256,7 @@ static int xgene_v1_pcie_ecam_init(struct pci_config_window *cfg)
 	return xgene_pcie_ecam_init(cfg, XGENE_PCIE_IP_VER_1);
 }
 
-struct pci_ecam_ops xgene_v1_pcie_ecam_ops = {
+const struct pci_ecam_ops xgene_v1_pcie_ecam_ops = {
 	.bus_shift	= 16,
 	.init		= xgene_v1_pcie_ecam_init,
 	.pci_ops	= {
@@ -271,7 +271,7 @@ static int xgene_v2_pcie_ecam_init(struct pci_config_window *cfg)
 	return xgene_pcie_ecam_init(cfg, XGENE_PCIE_IP_VER_2);
 }
 
-struct pci_ecam_ops xgene_v2_pcie_ecam_ops = {
+const struct pci_ecam_ops xgene_v2_pcie_ecam_ops = {
 	.bus_shift	= 16,
 	.init		= xgene_v2_pcie_ecam_init,
 	.pci_ops	= {
diff --git a/drivers/pci/controller/pcie-tango.c b/drivers/pci/controller/pcie-tango.c
index 21a208da3f59..3b2b10906fdd 100644
--- a/drivers/pci/controller/pcie-tango.c
+++ b/drivers/pci/controller/pcie-tango.c
@@ -207,7 +207,7 @@ static int smp8759_config_write(struct pci_bus *bus, unsigned int devfn,
 	return ret;
 }
 
-static struct pci_ecam_ops smp8759_ecam_ops = {
+static const struct pci_ecam_ops smp8759_ecam_ops = {
 	.bus_shift	= 20,
 	.pci_ops	= {
 		.map_bus	= pci_ecam_map_bus,
diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c
index 1a81af0ba961..1b05ff627859 100644
--- a/drivers/pci/ecam.c
+++ b/drivers/pci/ecam.c
@@ -26,7 +26,7 @@ static const bool per_bus_mapping = !IS_ENABLED(CONFIG_64BIT);
  */
 struct pci_config_window *pci_ecam_create(struct device *dev,
 		struct resource *cfgres, struct resource *busr,
-		struct pci_ecam_ops *ops)
+		const struct pci_ecam_ops *ops)
 {
 	struct pci_config_window *cfg;
 	unsigned int bus_range, bus_range_max, bsz;
@@ -145,7 +145,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
 }
 
 /* ECAM ops */
-struct pci_ecam_ops pci_generic_ecam_ops = {
+const struct pci_ecam_ops pci_generic_ecam_ops = {
 	.bus_shift	= 20,
 	.pci_ops	= {
 		.map_bus	= pci_ecam_map_bus,
@@ -156,7 +156,7 @@ struct pci_ecam_ops pci_generic_ecam_ops = {
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
 /* ECAM ops for 32-bit access only (non-compliant) */
-struct pci_ecam_ops pci_32b_ops = {
+const struct pci_ecam_ops pci_32b_ops = {
 	.bus_shift	= 20,
 	.pci_ops	= {
 		.map_bus	= pci_ecam_map_bus,
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 2d155bfb8fbf..81f5535ca1b5 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -27,7 +27,7 @@ extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle);
 
 struct pci_ecam_ops;
 extern int pci_mcfg_lookup(struct acpi_pci_root *root, struct resource *cfgres,
-			   struct pci_ecam_ops **ecam_ops);
+			   const struct pci_ecam_ops **ecam_ops);
 
 static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
 {
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index a73164c85e78..6c21dd0901ab 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -29,7 +29,7 @@ struct pci_config_window {
 	struct resource			res;
 	struct resource			busr;
 	void				*priv;
-	struct pci_ecam_ops		*ops;
+	const struct pci_ecam_ops	*ops;
 	union {
 		void __iomem		*win;	/* 64-bit single mapping */
 		void __iomem		**winp; /* 32-bit per-bus mapping */
@@ -40,29 +40,29 @@ struct pci_config_window {
 /* create and free pci_config_window */
 struct pci_config_window *pci_ecam_create(struct device *dev,
 		struct resource *cfgres, struct resource *busr,
-		struct pci_ecam_ops *ops);
+		const struct pci_ecam_ops *ops);
 void pci_ecam_free(struct pci_config_window *cfg);
 
 /* map_bus when ->sysdata is an instance of pci_config_window */
 void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
 			       int where);
 /* default ECAM ops */
-extern struct pci_ecam_ops pci_generic_ecam_ops;
+extern const struct pci_ecam_ops pci_generic_ecam_ops;
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
-extern struct pci_ecam_ops pci_32b_ops;		/* 32-bit accesses only */
-extern struct pci_ecam_ops hisi_pcie_ops;	/* HiSilicon */
-extern struct pci_ecam_ops thunder_pem_ecam_ops; /* Cavium ThunderX 1.x & 2.x */
-extern struct pci_ecam_ops pci_thunder_ecam_ops; /* Cavium ThunderX 1.x */
-extern struct pci_ecam_ops xgene_v1_pcie_ecam_ops; /* APM X-Gene PCIe v1 */
-extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */
-extern struct pci_ecam_ops al_pcie_ops; /* Amazon Annapurna Labs PCIe */
+extern const struct pci_ecam_ops pci_32b_ops;	/* 32-bit accesses only */
+extern const struct pci_ecam_ops hisi_pcie_ops;	/* HiSilicon */
+extern const struct pci_ecam_ops thunder_pem_ecam_ops; /* Cavium ThunderX 1.x & 2.x */
+extern const struct pci_ecam_ops pci_thunder_ecam_ops; /* Cavium ThunderX 1.x */
+extern const struct pci_ecam_ops xgene_v1_pcie_ecam_ops; /* APM X-Gene PCIe v1 */
+extern const struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */
+extern const struct pci_ecam_ops al_pcie_ops;	/* Amazon Annapurna Labs PCIe */
 #endif
 
 #ifdef CONFIG_PCI_HOST_COMMON
 /* for DT-based PCI controllers that support ECAM */
 int pci_host_common_probe(struct platform_device *pdev,
-			  struct pci_ecam_ops *ops);
+			  const struct pci_ecam_ops *ops);
 int pci_host_common_remove(struct platform_device *pdev);
 #endif
 #endif
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/3] PCI: host-generic: Support building as modules
  2020-04-09 23:49 [PATCH 0/3] PCI: Modularize host-generic Rob Herring
  2020-04-09 23:49 ` [PATCH 1/3] PCI: Constify struct pci_ecam_ops Rob Herring
@ 2020-04-09 23:49 ` Rob Herring
  2020-04-28 13:31   ` Will Deacon
  2020-04-09 23:49 ` [PATCH 3/3] PCI: host-generic: Eliminate pci_host_common_probe wrappers Rob Herring
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2020-04-09 23:49 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Will Deacon
  Cc: Andrew Murray, Catalin Marinas, Mans Rullgard, Marc Gonzalez,
	Robert Richter, Zhou Wang, Toan Le, Rafael J. Wysocki, Len Brown,
	Jonathan Chocron, linux-acpi, linux-arm-kernel, linux-pci

Enable building host-generic and its host-common dependency as a
module.

Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Andrew Murray <amurray@thegoodpenguin.co.uk>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-pci@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/pci/controller/Kconfig            | 4 ++--
 drivers/pci/controller/pci-host-common.c  | 5 +++++
 drivers/pci/controller/pci-host-generic.c | 7 +++++--
 drivers/pci/ecam.c                        | 4 ++++
 drivers/pci/setup-bus.c                   | 1 +
 include/linux/pci-ecam.h                  | 2 +-
 6 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index 91bfdb784829..416a53414728 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -62,11 +62,11 @@ config PCIE_RCAR
 	  Say Y here if you want PCIe controller support on R-Car SoCs.
 
 config PCI_HOST_COMMON
-	bool
+	tristate
 	select PCI_ECAM
 
 config PCI_HOST_GENERIC
-	bool "Generic PCI host controller"
+	tristate "Generic PCI host controller"
 	depends on OF
 	select PCI_HOST_COMMON
 	select IRQ_DOMAIN
diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index f6d5dc068488..6d15bc12e726 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -8,6 +8,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 #include <linux/pci-ecam.h>
@@ -95,6 +96,7 @@ int pci_host_common_probe(struct platform_device *pdev,
 	platform_set_drvdata(pdev, bridge->bus);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(pci_host_common_probe);
 
 int pci_host_common_remove(struct platform_device *pdev)
 {
@@ -107,3 +109,6 @@ int pci_host_common_remove(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(pci_host_common_remove);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/controller/pci-host-generic.c b/drivers/pci/controller/pci-host-generic.c
index 7e9a7c0833b1..fd8cff61de14 100644
--- a/drivers/pci/controller/pci-host-generic.c
+++ b/drivers/pci/controller/pci-host-generic.c
@@ -10,6 +10,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 #include <linux/pci-ecam.h>
@@ -76,6 +77,7 @@ static const struct of_device_id gen_pci_of_match[] = {
 
 	{ },
 };
+MODULE_DEVICE_TABLE(of, gen_pci_of_match);
 
 static int gen_pci_probe(struct platform_device *pdev)
 {
@@ -92,9 +94,10 @@ static struct platform_driver gen_pci_driver = {
 	.driver = {
 		.name = "pci-host-generic",
 		.of_match_table = gen_pci_of_match,
-		.suppress_bind_attrs = true,
 	},
 	.probe = gen_pci_probe,
 	.remove = pci_host_common_remove,
 };
-builtin_platform_driver(gen_pci_driver);
+module_platform_driver(gen_pci_driver);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c
index 1b05ff627859..8f065a42fc1a 100644
--- a/drivers/pci/ecam.c
+++ b/drivers/pci/ecam.c
@@ -101,6 +101,7 @@ struct pci_config_window *pci_ecam_create(struct device *dev,
 	pci_ecam_free(cfg);
 	return ERR_PTR(err);
 }
+EXPORT_SYMBOL_GPL(pci_ecam_create);
 
 void pci_ecam_free(struct pci_config_window *cfg)
 {
@@ -121,6 +122,7 @@ void pci_ecam_free(struct pci_config_window *cfg)
 		release_resource(&cfg->res);
 	kfree(cfg);
 }
+EXPORT_SYMBOL_GPL(pci_ecam_free);
 
 /*
  * Function to implement the pci_ops ->map_bus method
@@ -143,6 +145,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
 		base = cfg->win + (busn << cfg->ops->bus_shift);
 	return base + (devfn << devfn_shift) + where;
 }
+EXPORT_SYMBOL_GPL(pci_ecam_map_bus);
 
 /* ECAM ops */
 const struct pci_ecam_ops pci_generic_ecam_ops = {
@@ -153,6 +156,7 @@ const struct pci_ecam_ops pci_generic_ecam_ops = {
 		.write		= pci_generic_config_write,
 	}
 };
+EXPORT_SYMBOL_GPL(pci_generic_ecam_ops);
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
 /* ECAM ops for 32-bit access only (non-compliant) */
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index bbcef1a053ab..5b35f7fc2ace 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -26,6 +26,7 @@
 #include "pci.h"
 
 unsigned int pci_flags;
+EXPORT_SYMBOL_GPL(pci_flags);
 
 struct pci_dev_resource {
 	struct list_head list;
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index 6c21dd0901ab..fd0edb8b8a00 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -59,7 +59,7 @@ extern const struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x
 extern const struct pci_ecam_ops al_pcie_ops;	/* Amazon Annapurna Labs PCIe */
 #endif
 
-#ifdef CONFIG_PCI_HOST_COMMON
+#if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
 /* for DT-based PCI controllers that support ECAM */
 int pci_host_common_probe(struct platform_device *pdev,
 			  const struct pci_ecam_ops *ops);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/3] PCI: host-generic: Eliminate pci_host_common_probe wrappers
  2020-04-09 23:49 [PATCH 0/3] PCI: Modularize host-generic Rob Herring
  2020-04-09 23:49 ` [PATCH 1/3] PCI: Constify struct pci_ecam_ops Rob Herring
  2020-04-09 23:49 ` [PATCH 2/3] PCI: host-generic: Support building as modules Rob Herring
@ 2020-04-09 23:49 ` Rob Herring
  2020-05-01 14:16 ` [PATCH 0/3] PCI: Modularize host-generic Lorenzo Pieralisi
  2020-05-01 15:38 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2020-04-09 23:49 UTC (permalink / raw)
  To: Bjorn Helgaas, Lorenzo Pieralisi, Will Deacon
  Cc: Andrew Murray, Catalin Marinas, Mans Rullgard, Marc Gonzalez,
	Robert Richter, Zhou Wang, Toan Le, Rafael J. Wysocki, Len Brown,
	Jonathan Chocron, linux-acpi, linux-arm-kernel, linux-pci

Most ECAM host drivers are just different pci_ecam_ops which can be DT
match table data. That's already the case in some cases, but let's
do that for all the ECAM drivers. Then we can use
of_device_get_match_data() in pci_host_common_probe() and eliminate the
probe wrapper functions and use pci_host_common_probe() directly for
probe.

Cc: Zhou Wang <wangzhou1@hisilicon.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Andrew Murray <amurray@thegoodpenguin.co.uk>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Will Deacon <will@kernel.org>
Cc: Robert Richter <rrichter@marvell.com>
Cc: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Mans Rullgard <mans@mansr.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/pci/controller/dwc/pcie-hisi.c    | 11 +----------
 drivers/pci/controller/pci-host-common.c  |  9 +++++++--
 drivers/pci/controller/pci-host-generic.c | 15 +--------------
 drivers/pci/controller/pci-thunder-ecam.c | 12 +++++-------
 drivers/pci/controller/pci-thunder-pem.c  | 12 +++++-------
 drivers/pci/controller/pcie-tango.c       |  7 +++++--
 include/linux/pci-ecam.h                  |  3 +--
 7 files changed, 25 insertions(+), 44 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-hisi.c b/drivers/pci/controller/dwc/pcie-hisi.c
index 90017045334d..0ba50fb473b1 100644
--- a/drivers/pci/controller/dwc/pcie-hisi.c
+++ b/drivers/pci/controller/dwc/pcie-hisi.c
@@ -332,15 +332,6 @@ static struct platform_driver hisi_pcie_driver = {
 };
 builtin_platform_driver(hisi_pcie_driver);
 
-static int hisi_pcie_almost_ecam_probe(struct platform_device *pdev)
-{
-	struct device *dev = &pdev->dev;
-	struct pci_ecam_ops *ops;
-
-	ops = (struct pci_ecam_ops *)of_device_get_match_data(dev);
-	return pci_host_common_probe(pdev, ops);
-}
-
 static int hisi_pcie_platform_init(struct pci_config_window *cfg)
 {
 	struct device *dev = cfg->parent;
@@ -385,7 +376,7 @@ static const struct of_device_id hisi_pcie_almost_ecam_of_match[] = {
 };
 
 static struct platform_driver hisi_pcie_almost_ecam_driver = {
-	.probe  = hisi_pcie_almost_ecam_probe,
+	.probe  = pci_host_common_probe,
 	.driver = {
 		   .name = "hisi-pcie-almost-ecam",
 		   .of_match_table = hisi_pcie_almost_ecam_of_match,
diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index 6d15bc12e726..953de57f6c57 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/of_pci.h>
 #include <linux/pci-ecam.h>
 #include <linux/platform_device.h>
@@ -55,15 +56,19 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
 	return ERR_PTR(err);
 }
 
-int pci_host_common_probe(struct platform_device *pdev,
-			  const struct pci_ecam_ops *ops)
+int pci_host_common_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct pci_host_bridge *bridge;
 	struct pci_config_window *cfg;
 	struct list_head resources;
+	const struct pci_ecam_ops *ops;
 	int ret;
 
+	ops = of_device_get_match_data(&pdev->dev);
+	if (!ops)
+		return -ENODEV;
+
 	bridge = devm_pci_alloc_host_bridge(dev, 0);
 	if (!bridge)
 		return -ENOMEM;
diff --git a/drivers/pci/controller/pci-host-generic.c b/drivers/pci/controller/pci-host-generic.c
index fd8cff61de14..b51977abfdf1 100644
--- a/drivers/pci/controller/pci-host-generic.c
+++ b/drivers/pci/controller/pci-host-generic.c
@@ -11,8 +11,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/of_pci.h>
 #include <linux/pci-ecam.h>
 #include <linux/platform_device.h>
 
@@ -79,23 +77,12 @@ static const struct of_device_id gen_pci_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, gen_pci_of_match);
 
-static int gen_pci_probe(struct platform_device *pdev)
-{
-	const struct of_device_id *of_id;
-	struct pci_ecam_ops *ops;
-
-	of_id = of_match_node(gen_pci_of_match, pdev->dev.of_node);
-	ops = (struct pci_ecam_ops *)of_id->data;
-
-	return pci_host_common_probe(pdev, ops);
-}
-
 static struct platform_driver gen_pci_driver = {
 	.driver = {
 		.name = "pci-host-generic",
 		.of_match_table = gen_pci_of_match,
 	},
-	.probe = gen_pci_probe,
+	.probe = pci_host_common_probe,
 	.remove = pci_host_common_remove,
 };
 module_platform_driver(gen_pci_driver);
diff --git a/drivers/pci/controller/pci-thunder-ecam.c b/drivers/pci/controller/pci-thunder-ecam.c
index c3fdd3e6b21c..7e8835fee5f7 100644
--- a/drivers/pci/controller/pci-thunder-ecam.c
+++ b/drivers/pci/controller/pci-thunder-ecam.c
@@ -357,22 +357,20 @@ const struct pci_ecam_ops pci_thunder_ecam_ops = {
 #ifdef CONFIG_PCI_HOST_THUNDER_ECAM
 
 static const struct of_device_id thunder_ecam_of_match[] = {
-	{ .compatible = "cavium,pci-host-thunder-ecam" },
+	{
+		.compatible = "cavium,pci-host-thunder-ecam",
+		.data = &pci_thunder_ecam_ops,
+	},
 	{ },
 };
 
-static int thunder_ecam_probe(struct platform_device *pdev)
-{
-	return pci_host_common_probe(pdev, &pci_thunder_ecam_ops);
-}
-
 static struct platform_driver thunder_ecam_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = thunder_ecam_of_match,
 		.suppress_bind_attrs = true,
 	},
-	.probe = thunder_ecam_probe,
+	.probe = pci_host_common_probe,
 };
 builtin_platform_driver(thunder_ecam_driver);
 
diff --git a/drivers/pci/controller/pci-thunder-pem.c b/drivers/pci/controller/pci-thunder-pem.c
index 2e792707ceab..3f847969143e 100644
--- a/drivers/pci/controller/pci-thunder-pem.c
+++ b/drivers/pci/controller/pci-thunder-pem.c
@@ -451,22 +451,20 @@ static const struct pci_ecam_ops pci_thunder_pem_ops = {
 };
 
 static const struct of_device_id thunder_pem_of_match[] = {
-	{ .compatible = "cavium,pci-host-thunder-pem" },
+	{
+		.compatible = "cavium,pci-host-thunder-pem",
+		.data = &pci_thunder_pem_ops,
+	},
 	{ },
 };
 
-static int thunder_pem_probe(struct platform_device *pdev)
-{
-	return pci_host_common_probe(pdev, &pci_thunder_pem_ops);
-}
-
 static struct platform_driver thunder_pem_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = thunder_pem_of_match,
 		.suppress_bind_attrs = true,
 	},
-	.probe = thunder_pem_probe,
+	.probe = pci_host_common_probe,
 };
 builtin_platform_driver(thunder_pem_driver);
 
diff --git a/drivers/pci/controller/pcie-tango.c b/drivers/pci/controller/pcie-tango.c
index 3b2b10906fdd..c56c5539da6b 100644
--- a/drivers/pci/controller/pcie-tango.c
+++ b/drivers/pci/controller/pcie-tango.c
@@ -295,11 +295,14 @@ static int tango_pcie_probe(struct platform_device *pdev)
 	spin_lock_init(&pcie->used_msi_lock);
 	irq_set_chained_handler_and_data(virq, tango_msi_isr, pcie);
 
-	return pci_host_common_probe(pdev, &smp8759_ecam_ops);
+	return pci_host_common_probe(pdev);
 }
 
 static const struct of_device_id tango_pcie_ids[] = {
-	{ .compatible = "sigma,smp8759-pcie" },
+	{
+		.compatible = "sigma,smp8759-pcie",
+		.data = &smp8759_ecam_ops,
+ 	},
 	{ },
 };
 
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index fd0edb8b8a00..1af5cb02ef7f 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -61,8 +61,7 @@ extern const struct pci_ecam_ops al_pcie_ops;	/* Amazon Annapurna Labs PCIe */
 
 #if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
 /* for DT-based PCI controllers that support ECAM */
-int pci_host_common_probe(struct platform_device *pdev,
-			  const struct pci_ecam_ops *ops);
+int pci_host_common_probe(struct platform_device *pdev);
 int pci_host_common_remove(struct platform_device *pdev);
 #endif
 #endif
-- 
2.20.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] PCI: Constify struct pci_ecam_ops
  2020-04-09 23:49 ` [PATCH 1/3] PCI: Constify struct pci_ecam_ops Rob Herring
@ 2020-04-14 10:22   ` Catalin Marinas
  0 siblings, 0 replies; 9+ messages in thread
From: Catalin Marinas @ 2020-04-14 10:22 UTC (permalink / raw)
  To: Rob Herring
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Will Deacon, Andrew Murray,
	Mans Rullgard, Marc Gonzalez, Robert Richter, Zhou Wang, Toan Le,
	Rafael J. Wysocki, Len Brown, Jonathan Chocron, linux-acpi,
	linux-arm-kernel, linux-pci

On Thu, Apr 09, 2020 at 05:49:21PM -0600, Rob Herring wrote:
> struct pci_ecam_ops is typically DT match table data which is defined to
> be const. It's also best practice for ops structs to be const. Ideally,
> we'd make struct pci_ops const as well, but that becomes pretty
> invasive, so for now we just cast it where needed.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Andrew Murray <amurray@thegoodpenguin.co.uk>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Jonathan Chocron <jonnyc@amazon.com>
> Cc: Zhou Wang <wangzhou1@hisilicon.com>
> Cc: Robert Richter <rrichter@marvell.com>
> Cc: Toan Le <toan@os.amperecomputing.com>
> Cc: Marc Gonzalez <marc.w.gonzalez@free.fr>
> Cc: Mans Rullgard <mans@mansr.com>
> Cc: linux-acpi@vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  arch/arm64/kernel/pci.c                   |  4 ++--

For arm64:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] PCI: host-generic: Support building as modules
  2020-04-09 23:49 ` [PATCH 2/3] PCI: host-generic: Support building as modules Rob Herring
@ 2020-04-28 13:31   ` Will Deacon
  0 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2020-04-28 13:31 UTC (permalink / raw)
  To: Rob Herring
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Andrew Murray, Catalin Marinas,
	Mans Rullgard, Marc Gonzalez, Robert Richter, Zhou Wang, Toan Le,
	Rafael J. Wysocki, Len Brown, Jonathan Chocron, linux-acpi,
	linux-arm-kernel, linux-pci

On Thu, Apr 09, 2020 at 05:49:22PM -0600, Rob Herring wrote:
> Enable building host-generic and its host-common dependency as a
> module.
> 
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Andrew Murray <amurray@thegoodpenguin.co.uk>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-pci@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/pci/controller/Kconfig            | 4 ++--
>  drivers/pci/controller/pci-host-common.c  | 5 +++++
>  drivers/pci/controller/pci-host-generic.c | 7 +++++--
>  drivers/pci/ecam.c                        | 4 ++++
>  drivers/pci/setup-bus.c                   | 1 +
>  include/linux/pci-ecam.h                  | 2 +-
>  6 files changed, 18 insertions(+), 5 deletions(-)

Acked-by: Will Deacon <will@kernel.org>

Will

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] PCI: Modularize host-generic
  2020-04-09 23:49 [PATCH 0/3] PCI: Modularize host-generic Rob Herring
                   ` (2 preceding siblings ...)
  2020-04-09 23:49 ` [PATCH 3/3] PCI: host-generic: Eliminate pci_host_common_probe wrappers Rob Herring
@ 2020-05-01 14:16 ` Lorenzo Pieralisi
  2020-05-01 14:46   ` Bjorn Helgaas
  2020-05-01 15:38 ` Lorenzo Pieralisi
  4 siblings, 1 reply; 9+ messages in thread
From: Lorenzo Pieralisi @ 2020-05-01 14:16 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas
  Cc: Will Deacon, Andrew Murray, Catalin Marinas, Mans Rullgard,
	Marc Gonzalez, Robert Richter, Zhou Wang, Toan Le,
	Rafael J. Wysocki, Len Brown, Jonathan Chocron, linux-acpi,
	linux-arm-kernel, linux-pci

On Thu, Apr 09, 2020 at 05:49:20PM -0600, Rob Herring wrote:
> This is part of a larger effort to modularize ARCH_VEXPRESS. In
> particular, the Arm FVP platforms use the host-generic driver. This
> conversion was straight-forward. I didn't convert the other ECAM drivers
> using host-common to modules, but am happy to do so if there's a strong
> desire to do so.
> 
> In the process, I noticed that 'const' was being dropped from the match
> table .data pointer, so the first patch constifies struct pci_ecam_ops.
> I started trying to constify pci_ops too, but that became a never ending
> treewide rabbit hole. So I ended up with a cast when we assign pci_ops
> from pci_ecam_ops.
> 
> Rob

Hi Bjorn,

if you don't have any objections I'd need your ACK to take this
series.

Thanks,
Lorenzo

> Rob Herring (3):
>   PCI: Constify struct pci_ecam_ops
>   PCI: host-generic: Support building as modules
>   PCI: host-generic: Eliminate pci_host_common_probe wrappers
> 
>  arch/arm64/kernel/pci.c                   |  4 ++--
>  drivers/acpi/pci_mcfg.c                   |  8 +++----
>  drivers/pci/controller/Kconfig            |  4 ++--
>  drivers/pci/controller/dwc/pcie-al.c      |  2 +-
>  drivers/pci/controller/dwc/pcie-hisi.c    | 19 +++++------------
>  drivers/pci/controller/pci-host-common.c  | 18 ++++++++++++----
>  drivers/pci/controller/pci-host-generic.c | 26 +++++++----------------
>  drivers/pci/controller/pci-thunder-ecam.c | 14 ++++++------
>  drivers/pci/controller/pci-thunder-pem.c  | 16 ++++++--------
>  drivers/pci/controller/pci-xgene.c        |  4 ++--
>  drivers/pci/controller/pcie-tango.c       |  9 +++++---
>  drivers/pci/ecam.c                        | 10 ++++++---
>  drivers/pci/setup-bus.c                   |  1 +
>  include/linux/pci-acpi.h                  |  2 +-
>  include/linux/pci-ecam.h                  | 25 +++++++++++-----------
>  15 files changed, 78 insertions(+), 84 deletions(-)
> 
> --
> 2.20.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] PCI: Modularize host-generic
  2020-05-01 14:16 ` [PATCH 0/3] PCI: Modularize host-generic Lorenzo Pieralisi
@ 2020-05-01 14:46   ` Bjorn Helgaas
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2020-05-01 14:46 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Rob Herring, Bjorn Helgaas, Will Deacon, Andrew Murray,
	Catalin Marinas, Mans Rullgard, Marc Gonzalez, Robert Richter,
	Zhou Wang, Toan Le, Rafael J. Wysocki, Len Brown,
	Jonathan Chocron, linux-acpi, linux-arm-kernel, linux-pci

On Fri, May 01, 2020 at 03:16:26PM +0100, Lorenzo Pieralisi wrote:
> On Thu, Apr 09, 2020 at 05:49:20PM -0600, Rob Herring wrote:
> > This is part of a larger effort to modularize ARCH_VEXPRESS. In
> > particular, the Arm FVP platforms use the host-generic driver. This
> > conversion was straight-forward. I didn't convert the other ECAM drivers
> > using host-common to modules, but am happy to do so if there's a strong
> > desire to do so.
> > 
> > In the process, I noticed that 'const' was being dropped from the match
> > table .data pointer, so the first patch constifies struct pci_ecam_ops.
> > I started trying to constify pci_ops too, but that became a never ending
> > treewide rabbit hole. So I ended up with a cast when we assign pci_ops
> > from pci_ecam_ops.
> > 
> > Rob
> 
> Hi Bjorn,
> 
> if you don't have any objections I'd need your ACK to take this
> series.

Oh, sorry, I didn't notice:

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> > Rob Herring (3):
> >   PCI: Constify struct pci_ecam_ops
> >   PCI: host-generic: Support building as modules
> >   PCI: host-generic: Eliminate pci_host_common_probe wrappers
> > 
> >  arch/arm64/kernel/pci.c                   |  4 ++--
> >  drivers/acpi/pci_mcfg.c                   |  8 +++----
> >  drivers/pci/controller/Kconfig            |  4 ++--
> >  drivers/pci/controller/dwc/pcie-al.c      |  2 +-
> >  drivers/pci/controller/dwc/pcie-hisi.c    | 19 +++++------------
> >  drivers/pci/controller/pci-host-common.c  | 18 ++++++++++++----
> >  drivers/pci/controller/pci-host-generic.c | 26 +++++++----------------
> >  drivers/pci/controller/pci-thunder-ecam.c | 14 ++++++------
> >  drivers/pci/controller/pci-thunder-pem.c  | 16 ++++++--------
> >  drivers/pci/controller/pci-xgene.c        |  4 ++--
> >  drivers/pci/controller/pcie-tango.c       |  9 +++++---
> >  drivers/pci/ecam.c                        | 10 ++++++---
> >  drivers/pci/setup-bus.c                   |  1 +
> >  include/linux/pci-acpi.h                  |  2 +-
> >  include/linux/pci-ecam.h                  | 25 +++++++++++-----------
> >  15 files changed, 78 insertions(+), 84 deletions(-)
> > 
> > --
> > 2.20.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] PCI: Modularize host-generic
  2020-04-09 23:49 [PATCH 0/3] PCI: Modularize host-generic Rob Herring
                   ` (3 preceding siblings ...)
  2020-05-01 14:16 ` [PATCH 0/3] PCI: Modularize host-generic Lorenzo Pieralisi
@ 2020-05-01 15:38 ` Lorenzo Pieralisi
  4 siblings, 0 replies; 9+ messages in thread
From: Lorenzo Pieralisi @ 2020-05-01 15:38 UTC (permalink / raw)
  To: Rob Herring
  Cc: Bjorn Helgaas, Will Deacon, Andrew Murray, Catalin Marinas,
	Mans Rullgard, Marc Gonzalez, Robert Richter, Zhou Wang, Toan Le,
	Rafael J. Wysocki, Len Brown, Jonathan Chocron, linux-acpi,
	linux-arm-kernel, linux-pci

On Thu, Apr 09, 2020 at 05:49:20PM -0600, Rob Herring wrote:
> This is part of a larger effort to modularize ARCH_VEXPRESS. In
> particular, the Arm FVP platforms use the host-generic driver. This
> conversion was straight-forward. I didn't convert the other ECAM drivers
> using host-common to modules, but am happy to do so if there's a strong
> desire to do so.
> 
> In the process, I noticed that 'const' was being dropped from the match
> table .data pointer, so the first patch constifies struct pci_ecam_ops.
> I started trying to constify pci_ops too, but that became a never ending
> treewide rabbit hole. So I ended up with a cast when we assign pci_ops
> from pci_ecam_ops.
> 
> Rob
> 
> 
> Rob Herring (3):
>   PCI: Constify struct pci_ecam_ops
>   PCI: host-generic: Support building as modules
>   PCI: host-generic: Eliminate pci_host_common_probe wrappers
> 
>  arch/arm64/kernel/pci.c                   |  4 ++--
>  drivers/acpi/pci_mcfg.c                   |  8 +++----
>  drivers/pci/controller/Kconfig            |  4 ++--
>  drivers/pci/controller/dwc/pcie-al.c      |  2 +-
>  drivers/pci/controller/dwc/pcie-hisi.c    | 19 +++++------------
>  drivers/pci/controller/pci-host-common.c  | 18 ++++++++++++----
>  drivers/pci/controller/pci-host-generic.c | 26 +++++++----------------
>  drivers/pci/controller/pci-thunder-ecam.c | 14 ++++++------
>  drivers/pci/controller/pci-thunder-pem.c  | 16 ++++++--------
>  drivers/pci/controller/pci-xgene.c        |  4 ++--
>  drivers/pci/controller/pcie-tango.c       |  9 +++++---
>  drivers/pci/ecam.c                        | 10 ++++++---
>  drivers/pci/setup-bus.c                   |  1 +
>  include/linux/pci-acpi.h                  |  2 +-
>  include/linux/pci-ecam.h                  | 25 +++++++++++-----------
>  15 files changed, 78 insertions(+), 84 deletions(-)

Applied to pci/host-generic for v5.8, thanks !

Lorenzo

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-05-01 15:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09 23:49 [PATCH 0/3] PCI: Modularize host-generic Rob Herring
2020-04-09 23:49 ` [PATCH 1/3] PCI: Constify struct pci_ecam_ops Rob Herring
2020-04-14 10:22   ` Catalin Marinas
2020-04-09 23:49 ` [PATCH 2/3] PCI: host-generic: Support building as modules Rob Herring
2020-04-28 13:31   ` Will Deacon
2020-04-09 23:49 ` [PATCH 3/3] PCI: host-generic: Eliminate pci_host_common_probe wrappers Rob Herring
2020-05-01 14:16 ` [PATCH 0/3] PCI: Modularize host-generic Lorenzo Pieralisi
2020-05-01 14:46   ` Bjorn Helgaas
2020-05-01 15:38 ` Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).