aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Larsson <andreas@gaisler.com>2012-11-05 19:12:03 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-09 19:30:50 -0500
commit0bce04be442cf4d6e4ba9dac2f0a4c5ee88af5c5 (patch)
tree97c771cc2cafbad347b0ef71eafd957ca06357a9
parent20424d85f8a07090fd32c6fad343f91b63c730b0 (diff)
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>
-rw-r--r--arch/sparc/include/asm/prom.h5
-rw-r--r--include/linux/of_address.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c28765110706..f93003123bce 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,10 @@ extern char *of_console_options;
63extern void irq_trans_init(struct device_node *dp); 63extern void irq_trans_init(struct device_node *dp);
64extern char *build_path_component(struct device_node *dp); 64extern char *build_path_component(struct device_node *dp);
65 65
66/* SPARC has a local implementation */
67extern 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#endif /* __KERNEL__ */ 71#endif /* __KERNEL__ */
67#endif /* _SPARC_PROM_H */ 72#endif /* _SPARC_PROM_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd037da..e20e3af68fb6 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
28#endif 28#endif
29 29
30#else /* CONFIG_OF_ADDRESS */ 30#else /* CONFIG_OF_ADDRESS */
31#ifndef of_address_to_resource
31static inline int of_address_to_resource(struct device_node *dev, int index, 32static inline int of_address_to_resource(struct device_node *dev, int index,
32 struct resource *r) 33 struct resource *r)
33{ 34{
34 return -EINVAL; 35 return -EINVAL;
35} 36}
37#endif
36static inline struct device_node *of_find_matching_node_by_address( 38static inline struct device_node *of_find_matching_node_by_address(
37 struct device_node *from, 39 struct device_node *from,
38 const struct of_device_id *matches, 40 const struct of_device_id *matches,