Skip to contentSkip to conversation

Staging: board: Add identifier for 'of_find_all_nodes'

PATCH In review Vatika Harlalka 2 participants 2 messages Feb 20, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: board: Add identifier for 'of_find_all_nodes'

This patch fixes sparse errors for this driver related to identifiers and casting for of_find_all_nodes in linux/of.h library.

---
 drivers/staging/board/board.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/board/board.c +1 -0
index d5a6abc..666e000 100644
@@ -5,6 +5,7 @@
 #include <linux/of_address.h>
 #include "board.h"
 
+extern struct device_node *of_find_all_nodes(struct device_node *prev);
 static bool find_by_address(u64 base_address)
 {
 	struct device_node *dn = of_find_all_nodes(NULL);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 13 lines · On Friday 20 February 2015 15:47:47 Vatika Harlalka wrote:

This patch fixes sparse errors for this driver related to identifiers and casting for of_find_all_nodes in linux/of.h library.

---
 drivers/staging/board/board.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/board/board.c +0 -0
index d5a6abc..666e000 100644

drivers/staging/board/board.c line 11

Quoted 7 lines
drivers/staging/board/board.c +1 -0
@@ -5,6 +5,7 @@
 #include <linux/of_address.h>
 #include "board.h"
 
+extern struct device_node *of_find_all_nodes(struct device_node *prev);
 static bool find_by_address(u64 base_address)
 {
        struct device_node *dn = of_find_all_nodes(NULL);

No, you should never add 'extern' declarations to a C file. The rule is that you need to include the correct header file that contains the declaration.

In this particular case, the header file is included, but the declaration is hidden in #ifdef CONFIG_OF, so you should probably make sure the driver cannot be compiled if CONFIG_OF is disabled.

Arnd