Skip to contentSkip to conversation

of: Add two stubs for OF_ADDRESS=n and OF=n cases

PATCH In review Magnus Damm 2 participants 4 messages Jun 6, 2014 Device tree

lore
Share & tools
lore
#0 lore raw

cover of: Add two stubs for OF_ADDRESS=n and OF=n cases

of: Add two stubs for OF_ADDRESS=n and OF=n cases

[PATCH 01/02] of: Add OF_ADDRESS=n stub for of_can_translate_address() [PATCH 02/02] of: Add OF=n stub for of_find_all_nodes()

This series adds include file stubs for the following functions:
- of_can_translate_address() in of_address.h
- of_find_all_nodes() in of.h

With these stubs in place it is possible to remove Kconfig dependencies for OF and OF_ADDRESS in certain cases and just depend on the default behaviour of the stubs.

---

Written against renesas git repo at kernel.org using tag renesas-devel-v3.15-rc8-20140606 which for this code is the same as v3.15-rc8. Let me know if you want me to rebase.

 include/linux/of.h         |    5 +++++
 include/linux/of_address.h |    5 +++++
 2 files changed, 10 insertions(+)
#1 lore raw

PATCH 1/2 of: Add OF_ADDRESS=n stub for of_can_translate_address()

From: Magnus Damm <[email protected]>

Add a stub for the CONFIG_OF_ADDRESS=n case of of_translate_address(). The return value for the stub is false which is in sync with when the full version of the function does not support address translation. Added to allow removal of Kconfig dependency handling for CONFIG_OF_ADDRESS.

---

 include/linux/of_address.h |    5 +++++
 1 file changed, 5 insertions(+)
include/linux/of_address.h +5 -0
@@ -64,6 +64,11 @@ extern struct of_pci_range *of_pci_range
 					struct of_pci_range_parser *parser,
 					struct of_pci_range *range);
 #else /* CONFIG_OF_ADDRESS */
+static inline bool of_can_translate_address(struct device_node *dev)
+{
+	return false;
+}
+
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
#2 lore raw

Re: [PATCH 01/02] of: Add OF_ADDRESS=n stub for of_can_translate_address()

Quoted 8 lines · Magnus Damm

From: Magnus Damm <[email protected]>

Add a stub for the CONFIG_OF_ADDRESS=n case of of_translate_address(). The return value for the stub is false which is in sync with when the full version of the function does not support address translation. Added to allow removal of Kconfig dependency handling for CONFIG_OF_ADDRESS.

of_can_translate_address is gone in 3.16.

Rob

Quoted 21 lines

---

 include/linux/of_address.h |    5 +++++
 1 file changed, 5 insertions(+)
include/linux/of_address.h 2014-06-06 19:04:44.000000000 +0900 renamed from include/linux/of_address.h +5 -0
@@ -64,6 +64,11 @@ extern struct of_pci_range *of_pci_range
                                        struct of_pci_range_parser *parser,
                                        struct of_pci_range *range);
 #else /* CONFIG_OF_ADDRESS */
+static inline bool of_can_translate_address(struct device_node *dev)
+{
+       return false;
+}
+
 static inline struct device_node *of_find_matching_node_by_address(
                                        struct device_node *from,
                                        const struct of_device_id *matches,
#3 lore raw

PATCH 2/2 of: Add OF=n stub for of_find_all_nodes()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add a stub for the CONFIG_OF=n case of of_find_all_nodes(). The return value for the stub is NULL which is in sync with when the full version of the function cannot find any nodes registered. Added to allow removal of Kconfig dependency handling for CONFIG_OF.

---

 include/linux/of.h |    5 +++++
 1 file changed, 5 insertions(+)
include/linux/of.h +5 -0
@@ -349,6 +349,11 @@ int of_device_is_stdout_path(struct devi
 
 #else /* CONFIG_OF */
 
+static inline struct device_node *of_find_all_nodes(struct device_node *prev)
+{
+	return NULL;
+}
+
 static inline const char* of_node_full_name(const struct device_node *np)
 {
 	return "<no-node>";