[PATCH 1/2] fixup! of: import pci range parser from linux

Lucas Stach dev at lynxeye.de
Wed Oct 1 12:14:14 PDT 2014


Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
Correct dependencies and put function definitions under
correct ifdef to avoid build warnings/errors on systems
with PCI but without OF.
---
 drivers/of/Kconfig   |  1 +
 drivers/of/address.c |  4 ++--
 include/of_address.h | 22 +++++++++++++++-------
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 8195506..39cd138 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -30,6 +30,7 @@ config OF_GPIO
 config OF_PCI
 	bool
 	depends on PCI
+	select OF_ADDRESS_PCI
 	help
 	  OpenFirmware PCI bus accessors
 
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 15f3ade..8018d78 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -179,7 +179,7 @@ static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
 }
 #endif /* CONFIG_OF_ADDRESS_PCI */
 
-#ifdef CONFIG_PCI
+#ifdef CONFIG_OF_PCI
 int of_pci_range_parser_init(struct of_pci_range_parser *parser,
 				struct device_node *node)
 {
@@ -245,7 +245,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
 	return range;
 }
 EXPORT_SYMBOL_GPL(of_pci_range_parser_one);
-#endif /* CONFIG_PCI */
+#endif /* CONFIG_OF_PCI */
 
 /*
  * Array of bus specific translators
diff --git a/include/of_address.h b/include/of_address.h
index f9c3c0f..cef785e 100644
--- a/include/of_address.h
+++ b/include/of_address.h
@@ -55,11 +55,7 @@ extern struct device_node *of_find_matching_node_by_address(
 	struct device_node *from, const struct of_device_id *matches,
 	u64 base_address);
 extern void __iomem *of_iomap(struct device_node *np, int index);
-extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
-			struct device_node *node);
-extern struct of_pci_range *of_pci_range_parser_one(
-			struct of_pci_range_parser *parser,
-			struct of_pci_range *range);
+
 #else /* CONFIG_OFTREE */
 
 static inline u64 of_translate_address(struct device_node *dev,
@@ -103,6 +99,20 @@ static inline void __iomem *of_iomap(struct device_node *np, int index)
 	return NULL;
 }
 
+#endif /* CONFIG_OFTREE */
+
+#ifdef CONFIG_OF_PCI
+
+extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
+			struct device_node *node);
+
+extern struct of_pci_range *of_pci_range_parser_one(
+			struct of_pci_range_parser *parser,
+			struct of_pci_range *range);
+
+#else
+
+#endif /* CONFIG_OF_PCI */
 static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
 			struct device_node *node)
 {
@@ -116,6 +126,4 @@ static inline struct of_pci_range *of_pci_range_parser_one(
 	return NULL;
 }
 
-#endif /* CONFIG_OFTREE */
-
 #endif /* __OF_ADDRESS_H */
-- 
1.9.3




More information about the barebox mailing list