]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
sparc: Implement of_address_to_resource().
authorDavid S. Miller <davem@davemloft.net>
Fri, 18 Mar 2011 22:31:19 +0000 (15:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Mar 2011 22:31:19 +0000 (15:31 -0700)
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>
arch/sparc/kernel/of_device_common.c

index 49ddff56cb04130ce1a84ccb0ed152ebf6516e9a..0ed0321d84e99382a33ebd8417c1ca38a449a3de 100644 (file)
@@ -22,6 +22,19 @@ unsigned int irq_of_parse_and_map(struct device_node *node, int index)
 }
 EXPORT_SYMBOL(irq_of_parse_and_map);
 
+int of_address_to_resource(struct device_node *node, int index,
+                          struct resource *r)
+{
+       struct platform_device *op = of_find_device_by_node(node);
+
+       if (!op || index >= op->num_resources)
+               return -EINVAL;
+
+       memcpy(r, &op->archdata.resource[index], sizeof(*r));
+       return 0;
+}
+EXPORT_SYMBOL_GPL(of_address_to_resource);
+
 /* Take the archdata values for IOMMU, STC, and HOSTDATA found in
  * BUS and propagate to all child platform_device objects.
  */