Staging: board: Add identifier for 'of_find_all_nodes'
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.
Signed-off-by Vatika Harlalka <[email protected]>
--- drivers/staging/board/board.c | 1 + 1 file changed, 1 insertion(+)
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 );
Signature · 1 line
1.9.1
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_nodesinlinux/of.hlibrary.Signed-off-by Vatika Harlalka <[email protected]>--- drivers/staging/board/board.c | 1 + 1 file changed, 1 insertion(+)drivers/staging/board/board.c +0
-0
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