aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-18 18:31:19 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-18 18:31:19 -0400
commit930952af15f8425115528447102ed97610e98949 (patch)
tree00b89f25d523540e121b0d0bb479da8dc869e411 /arch/sparc/kernel
parent1655068029a6e86682fe97a687db9db0aae5af81 (diff)
sparc: Implement of_address_to_resource().
Similarly to irq_of_parse_and_map(), find the platform_device object and return the pre-computed resource. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/of_device_common.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 49ddff56cb04..0ed0321d84e9 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -22,6 +22,19 @@ unsigned int irq_of_parse_and_map(struct device_node *node, int index)
22} 22}
23EXPORT_SYMBOL(irq_of_parse_and_map); 23EXPORT_SYMBOL(irq_of_parse_and_map);
24 24
25int of_address_to_resource(struct device_node *node, int index,
26 struct resource *r)
27{
28 struct platform_device *op = of_find_device_by_node(node);
29
30 if (!op || index >= op->num_resources)
31 return -EINVAL;
32
33 memcpy(r, &op->archdata.resource[index], sizeof(*r));
34 return 0;
35}
36EXPORT_SYMBOL_GPL(of_address_to_resource);
37
25/* Take the archdata values for IOMMU, STC, and HOSTDATA found in 38/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
26 * BUS and propagate to all child platform_device objects. 39 * BUS and propagate to all child platform_device objects.
27 */ 40 */