[RFC PATCH 2/3] devicetree: provide hook to allow setting devicetree device name
From: Frank Rowand
Date: Tue May 06 2014 - 20:52:42 EST
From: Frank Rowand <frank.rowand@xxxxxxxxxxxxxx>
Optionally push devicetree device naming into a function called dynamically by
of_device_alloc().
TODO:
Change made to of_device_alloc() could also be made to
of_amba_device_create()
Signed-off-by: Frank Rowand <frank.rowand@xxxxxxxxxxxxxx>
---
drivers/of/platform.c | 2 ++
include/linux/of.h | 2 ++
3 files changed, 43 insertions(+)
Index: b/drivers/of/platform.c
===================================================================
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -179,6 +179,8 @@ struct platform_device *of_device_alloc(
if (bus_id)
dev_set_name(&dev->dev, "%s", bus_id);
+ else if (np->parent->of_device_make_bus_id)
+ np->parent->of_device_make_bus_id(&dev->dev);
else
of_device_make_bus_id(&dev->dev);
Index: b/include/linux/of.h
===================================================================
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -17,6 +17,7 @@
*/
#include <linux/types.h>
#include <linux/bitops.h>
+#include <linux/device.h>
#include <linux/errno.h>
#include <linux/kobject.h>
#include <linux/mod_devicetable.h>
@@ -60,6 +61,7 @@ struct device_node {
struct kobject kobj;
unsigned long _flags;
void *data;
+ void (*of_device_make_bus_id)(struct device *dev);
#if defined(CONFIG_SPARC)
const char *path_component_name;
unsigned int unique_id;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/