aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Bonesio <bones@secretlab.ca>2011-10-24 11:09:06 +0200
committerAndrey Konovalov <andrey.konovalov@linaro.org>2012-02-16 19:57:14 +0400
commit6d21aa69fdbc8ba4b19f7cb1330906e56d74c688 (patch)
tree078870dd961f8d6b63eadd34f7cec23c264bf039
parentdbc75ed3f60be4c61fe67a325f4df41da542c0cc (diff)
downloadvexpress-lsk-6d21aa69fdbc8ba4b19f7cb1330906e56d74c688.tar.gz
dt: Add id to AUXDATA structure
This patch adds the ability to set the device id in the AUXDATA structure for those few device drivers that just have to have a statically defined device id. Signed-off-by: John Bonesio <bones@secretlab.ca> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--drivers/of/platform.c7
-rw-r--r--include/linux/of_platform.h7
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 63b3ec48c20..7cf22e1f6ed 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -349,6 +349,7 @@ static int of_platform_bus_create(struct device_node *bus,
struct platform_device *dev;
const char *bus_id = NULL;
void *platform_data = NULL;
+ int id = -1;
int rc = 0;
/* Make sure it has a compatible property */
@@ -361,6 +362,7 @@ static int of_platform_bus_create(struct device_node *bus,
auxdata = of_dev_lookup(lookup, bus);
if (auxdata) {
bus_id = auxdata->name;
+ id = auxdata->id;
platform_data = auxdata->platform_data;
}
@@ -370,6 +372,11 @@ static int of_platform_bus_create(struct device_node *bus,
}
dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent);
+
+ /* override the id if auxdata gives an id */
+ if (id != -1)
+ dev->id = id;
+
if (!dev || !of_match_node(matches, bus))
return 0;
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 040ce2f6e8d..2e6631f4c13 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -44,13 +44,18 @@ struct of_dev_auxdata {
char *compatible;
resource_size_t phys_addr;
char *name;
+ int id;
void *platform_data;
};
/* Macro to simplify populating a lookup table */
#define OF_DEV_AUXDATA(_compat,_phys,_name,_pdata) \
{ .compatible = _compat, .phys_addr = _phys, .name = _name, \
- .platform_data = _pdata }
+ .id = -1, .platform_data = _pdata }
+
+#define OF_DEV_AUXDATA_ID(_compat,_phys,_name,_id,_pdata) \
+ { .compatible = _compat, .phys_addr = _phys, .name = _name, \
+ .id = _id, .platform_data = _pdata }
/**
* of_platform_driver - Legacy of-aware driver for platform devices.