[RFC 3/9] PCI/portdrv: create platform devices for child OF nodes

From: Bartosz Golaszewski
Date: Thu Jan 04 2024 - 08:04:04 EST


From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>

In order to introduce PCIe power-sequencing, we need to create platform
devices for child nodes of the port driver node. They will get matched
against the pwrseq drivers (if one exists) and then the actuak PCIe
device will reuse the node once it's detected on the bus.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
---
drivers/pci/pcie/portdrv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 14a4b89a3b83..401fb731009d 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -13,6 +13,7 @@
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/errno.h>
+#include <linux/of_platform.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/string.h>
@@ -715,7 +716,7 @@ static int pcie_portdrv_probe(struct pci_dev *dev,
pm_runtime_allow(&dev->dev);
}

- return 0;
+ return devm_of_platform_populate(&dev->dev);
}

static void pcie_portdrv_remove(struct pci_dev *dev)
--
2.40.1