summaryrefslogtreecommitdiff
path: root/include/linux/of_device.h
diff options
context:
space:
mode:
authorJoachim Eastwood <manabian@gmail.com>2015-05-06 21:09:09 +0300
committerRob Herring <robh@kernel.org>2015-05-28 20:59:40 +0300
commit3386e0fa905c31bf1dafa2cbe2ecceb7e5ce2e66 (patch)
tree7096ea89f1d2e5aa2366cf85b548d1c53284ed38 /include/linux/of_device.h
parent31712c98f8180c7bd3f33eefa461f0e1142e18f5 (diff)
downloadlinux-3386e0fa905c31bf1dafa2cbe2ecceb7e5ce2e66.tar.xz
of: add helper function to retrive match data
It's a common operation for device drivers to retrive the data member from of_device_id struct in their probe function. Most driver end up doing: const struct of_device_id *match; match = of_match_device(driver_of_match, &pdev->dev); driver->data = match->data; With the of_device_get_match_data helper function all this can done in one go. Signed-off-by: Joachim Eastwood <manabian@gmail.com> [robh: add missing inline to dummmy declaration] Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include/linux/of_device.h')
-rw-r--r--include/linux/of_device.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 22801b10cef5..4c508549833a 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -33,6 +33,8 @@ extern int of_device_add(struct platform_device *pdev);
extern int of_device_register(struct platform_device *ofdev);
extern void of_device_unregister(struct platform_device *ofdev);
+extern const void *of_device_get_match_data(const struct device *dev);
+
extern ssize_t of_device_get_modalias(struct device *dev,
char *str, ssize_t len);
@@ -65,6 +67,11 @@ static inline int of_driver_match_device(struct device *dev,
static inline void of_device_uevent(struct device *dev,
struct kobj_uevent_env *env) { }
+static inline const void *of_device_get_match_data(const struct device *dev)
+{
+ return NULL;
+}
+
static inline int of_device_get_modalias(struct device *dev,
char *str, ssize_t len)
{