Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again

This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.

The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADDRESS, and CONFIG_OF_ADDRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource there exists a sparc-specific implementation in
arch/sparc/arch/sparc/kernel/of_device_common.c

Solution suggested by: Sam Ravnborg <sam@ravnborg.org>

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andreas Larsson and committed by
David S. Miller
0bce04be 20424d85

+7
+5
arch/sparc/include/asm/prom.h
··· 63 63 extern void irq_trans_init(struct device_node *dp); 64 64 extern char *build_path_component(struct device_node *dp); 65 65 66 + /* SPARC has a local implementation */ 67 + extern int of_address_to_resource(struct device_node *dev, int index, 68 + struct resource *r); 69 + #define of_address_to_resource of_address_to_resource 70 + 66 71 #endif /* __KERNEL__ */ 67 72 #endif /* _SPARC_PROM_H */
+2
include/linux/of_address.h
··· 28 28 #endif 29 29 30 30 #else /* CONFIG_OF_ADDRESS */ 31 + #ifndef of_address_to_resource 31 32 static inline int of_address_to_resource(struct device_node *dev, int index, 32 33 struct resource *r) 33 34 { 34 35 return -EINVAL; 35 36 } 37 + #endif 36 38 static inline struct device_node *of_find_matching_node_by_address( 37 39 struct device_node *from, 38 40 const struct of_device_id *matches,