spmi: Add spmi_resource for non spmi-dev-container cases

The devnode array is currently being used for non
spmi-dev-container devices as a special case where the number of
devnodes is 1. This obfuscates the code and also removes the
ability to store the dev-container's device resource information,
since in that special case the devnode array is dedicated for the
child devices.

Add a new spmi_resource entry used for typical spmi_devices, and
treat the devnode array as the special case for
spmi-dev-container.

Also add a new API spmi_get_primary_dev_name() to return the name
of the device assigned with the 'label' binding if it exists.

Change-Id: Ibe7b12285e37bb0529024558550a96d71393bc10
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
diff --git a/drivers/spmi/spmi-resources.c b/drivers/spmi/spmi-resources.c
index 390e9ec..97f15ae 100644
--- a/drivers/spmi/spmi-resources.c
+++ b/drivers/spmi/spmi-resources.c
@@ -41,7 +41,7 @@
 
 	/* if a node is not specified, default to the first node */
 	if (!node)
-		node = &dev->dev_node[0];
+		node = &dev->res;
 
 	for (i = 0; i < node->num_resources; i++) {
 		struct resource *r = &node->resource[i];
@@ -71,7 +71,7 @@
 
 	/* if a node is not specified, default to the first node */
 	if (!node)
-		node = &dev->dev_node[0];
+		node = &dev->res;
 
 	for (i = 0; i < node->num_resources; i++) {
 		struct resource *r = &node->resource[i];
@@ -121,12 +121,15 @@
 EXPORT_SYMBOL_GPL(spmi_get_irq_byname);
 
 /*
- * spmi_get_devnode_byname - get a device node resource
+ * spmi_get_container_dev_byname - get a device node resource
  * @dev: spmi device handle
  * @label: device name to lookup
  *
- * Given a name, find the associated spmi_resource that matches the name.
- * Return NULL if the lookup fails.
+ * Only useable in spmi-dev-container configurations. Given a name,
+ * find the associated spmi_resource that matches the name.
+ *
+ * Return NULL if the spmi_device is not a dev-container,
+ * or if the lookup fails.
  */
 struct spmi_resource *spmi_get_dev_container_byname(struct spmi_device *dev,
 						    const char *label)