[PATCH 01/15] driver: add dev_get_drvdata function
Sascha Hauer
s.hauer at pengutronix.de
Wed Sep 12 16:06:33 EDT 2012
Drivers need to get their driver data either from devicetree or the platform
information. It should matter for the driver where this data comes from, so
introduce a common function for it.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/base/driver.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 47d3803..4d6b250 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -376,6 +376,16 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
return 0;
}
+int dev_get_drvdata(struct device_d *dev, unsigned long *data)
+{
+ if (dev->id_entry) {
+ *data = dev->id_entry->driver_data;
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
static int do_devinfo(int argc, char *argv[])
{
struct device_d *dev;
--
1.7.10.4
More information about the barebox
mailing list