Skip to contentSkip to conversation

of: unittest: Fix of_unittest_pci_node() kconfig dependencies

PATCH Applied Rob Herring 2 participants 3 messages Aug 24, 2023 – Aug 28, 2023 Device tree

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 of: unittest: Fix of_unittest_pci_node() kconfig dependencies

of_unittest_pci_node test depends on both CONFIG_PCI_DYNAMIC_OF_NODES and CONFIG_OF_OVERLAY. Move the test into the existing CONFIG_OF_OVERLAY ifdef and rework the CONFIG_PCI_DYNAMIC_OF_NODES dependency to use IS_ENABLED() instead. This reduces the combinations to build.

Fixes 26409dd04589 ("of: unittest: Add pci_dt_testdrv pci driver")
Cc Lizhi Hou <[email protected]>
---
 drivers/of/unittest.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/of/unittest.c +7 -9
index 9c0f352cb241..ad2b7879cc67 100644
@@ -3799,14 +3799,6 @@ static __init void of_unittest_overlay_high_level(void)
 	mutex_unlock(&of_mutex);
 }
 
-#else
-
-static inline __init void of_unittest_overlay_high_level(void) {}
-
-#endif
-
-#ifdef CONFIG_PCI_DYNAMIC_OF_NODES
-
 static int of_unittest_pci_dev_num;
 static int of_unittest_pci_child_num;
 
@@ -3954,6 +3946,9 @@ static void __init of_unittest_pci_node(void)
 	struct pci_dev *pdev = NULL;
 	int rc;
 
+	if (!IS_ENABLED(CONFIG_PCI_DYNAMIC_OF_NODES))
+		return;
+
 	rc = pci_register_driver(&testdrv_driver);
 	unittest(!rc, "Failed to register pci test driver; rc = %d\n", rc);
 	if (rc)
@@ -3987,7 +3982,10 @@ static void __init of_unittest_pci_node(void)
 		pci_dev_put(pdev);
 }
 #else
-static void __init of_unittest_pci_node(void) { }
+
+static inline __init void of_unittest_overlay_high_level(void) {}
+static inline __init void of_unittest_pci_node(void) { }
+
 #endif
 
 static int __init of_unittest(void)
Signature · 1 line
2.40.1
Acked-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Rob Herring

of_unittest_pci_node test depends on both CONFIG_PCI_DYNAMIC_OF_NODES and CONFIG_OF_OVERLAY. Move the test into the existing CONFIG_OF_OVERLAY ifdef and rework the CONFIG_PCI_DYNAMIC_OF_NODES dependency to use IS_ENABLED() instead. This reduces the combinations to build.

Fixes 26409dd04589 ("of: unittest: Add pci_dt_testdrv pci driver")
Cc Lizhi Hou <[email protected]>

Thanks.

Quoted 4 lines
---
 drivers/of/unittest.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
Signature · 1 line
~Randy
author maintainer Applied
#2 lore raw
In reply to Rob Herring
Quoted 6 lines · Rob Herring

of_unittest_pci_node test depends on both CONFIG_PCI_DYNAMIC_OF_NODES and CONFIG_OF_OVERLAY. Move the test into the existing CONFIG_OF_OVERLAY ifdef and rework the CONFIG_PCI_DYNAMIC_OF_NODES dependency to use IS_ENABLED() instead. This reduces the combinations to build.

Quoted 9 lines
Fixes 26409dd04589 ("of: unittest: Add pci_dt_testdrv pci driver")
Cc Lizhi Hou <[email protected]>
---
 drivers/of/unittest.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Applied, thanks!