[PATCH 01/15] driver: add dev_get_drvdata function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux