diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-02-17 04:37:15 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-02-28 03:36:38 -0500 |
commit | b826291c14c396e7aa5d84523aafac117f430902 (patch) | |
tree | ebabdbe338cfef0d31fc3f5d77c23f264215eede | |
parent | 3d6b88282751a3329d7b041a8d18db87641db9e8 (diff) |
drivercore/dt: add a match table pointer to struct device
Add a new .of_match field to struct device which points at the
matching device driver .of_match_table entry when a device is probed
via the device tree
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | include/linux/device.h | 1 | ||||
-rw-r--r-- | include/linux/of_device.h | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index ca5d25225aab..8d8e2675d07f 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -441,6 +441,7 @@ struct device { | |||
441 | struct dev_archdata archdata; | 441 | struct dev_archdata archdata; |
442 | 442 | ||
443 | struct device_node *of_node; /* associated device tree node */ | 443 | struct device_node *of_node; /* associated device tree node */ |
444 | const struct of_device_id *of_match; /* matching of_device_id from driver */ | ||
444 | 445 | ||
445 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 446 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
446 | 447 | ||
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 975d347079d9..8bfe6c1d4365 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
@@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev); | |||
18 | * @drv: the device_driver structure to test | 18 | * @drv: the device_driver structure to test |
19 | * @dev: the device structure to match against | 19 | * @dev: the device structure to match against |
20 | */ | 20 | */ |
21 | static inline int of_driver_match_device(const struct device *dev, | 21 | static inline int of_driver_match_device(struct device *dev, |
22 | const struct device_driver *drv) | 22 | const struct device_driver *drv) |
23 | { | 23 | { |
24 | return of_match_device(drv->of_match_table, dev) != NULL; | 24 | dev->of_match = of_match_device(drv->of_match_table, dev); |
25 | return dev->of_match != NULL; | ||
25 | } | 26 | } |
26 | 27 | ||
27 | extern struct platform_device *of_dev_get(struct platform_device *dev); | 28 | extern struct platform_device *of_dev_get(struct platform_device *dev); |