Skip to contentSkip to conversation

pcie/dpc: Match any port type

PATCH Applied Keith Busch 2 participants 3 messages Jul 6, 2016 – Jul 25, 2016 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pcie/dpc: Match any port type

PCIe port type values are not flags, so OR'ing them is not correct. Previously the result was equivalent to PCIe downstream ports, so we were missing binding to DPC capable root ports. This patch changes the type to 'any' so we can bind to both port types. While this will cause the code to check upstream ports, the driver won't probe them since these are not DPC capable.

---
 drivers/pci/pcie/pcie-dpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/pcie-dpc.c +1 -1
index ab552f1..0b36525 100644
@@ -138,7 +138,7 @@ static void dpc_remove(struct pcie_device *dev)
 
 static struct pcie_port_service_driver dpcdriver = {
 	.name		= "dpc",
-	.port_type	= PCI_EXP_TYPE_ROOT_PORT | PCI_EXP_TYPE_DOWNSTREAM,
+	.port_type	= PCIE_ANY_PORT,
 	.service	= PCIE_PORT_SERVICE_DPC,
 	.probe		= dpc_probe,
 	.remove		= dpc_remove,
Signature · 1 line
2.7.2
#1 lore raw

PATCH 2/2 pcie/dpc: Remove tristate module option

This patch changes the config type from tristate too bool. The driver doesn't automatically load based on any rules, so it needs to be built-in in order to bind to devices it needs to drive.

---
 drivers/pci/pcie/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/pcie/Kconfig +1 -4
index 22ca641..7fcea75 100644
@@ -83,7 +83,7 @@ config PCIE_PME
 	depends on PCIEPORTBUS && PM
 
 config PCIE_DPC
-	tristate "PCIe Downstream Port Containment support"
+	bool "PCIe Downstream Port Containment support"
 	depends on PCIEPORTBUS
 	default n
 	help
@@ -92,6 +92,3 @@ config PCIE_DPC
 	  will be handled by the DPC driver.  If your system doesn't
 	  have this capability or you do not want to use this feature,
 	  it is safe to answer N.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called pcie-dpc.
Signature · 1 line
2.7.2
#2 lore raw
In reply to Keith Busch
Quoted 10 lines · Keith Busch

PCIe port type values are not flags, so OR'ing them is not correct. Previously the result was equivalent to PCIe downstream ports, so we were missing binding to DPC capable root ports. This patch changes the type to 'any' so we can bind to both port types. While this will cause the code to check upstream ports, the driver won't probe them since these are not DPC capable.

Applied both to pci/dpc for v4.8, thanks!

Quoted 24 lines
---
 drivers/pci/pcie/pcie-dpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/pcie-dpc.c +1 -1
index ab552f1..0b36525 100644
@@ -138,7 +138,7 @@ static void dpc_remove(struct pcie_device *dev)
 
 static struct pcie_port_service_driver dpcdriver = {
 	.name		= "dpc",
-	.port_type	= PCI_EXP_TYPE_ROOT_PORT | PCI_EXP_TYPE_DOWNSTREAM,
+	.port_type	= PCIE_ANY_PORT,
 	.service	= PCIE_PORT_SERVICE_DPC,
 	.probe		= dpc_probe,
 	.remove		= dpc_remove,
Signature · 6 lines
2.7.2

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html