diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-05-09 08:49:50 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-05-09 08:49:50 +0200 |
commit | 5c83ce6091f7ec0ea25cd9c1fadbb8f3438fa2e4 (patch) | |
tree | 8d0679e366a3969e7357a68cd28924ce59acb9cb /drivers/of/device.c | |
parent | fd2f990204d5519acf766e2b486a69f0854b86cb (diff) | |
parent | d34b5ffc7f3972e91c9411e48b45b17b846fd555 (diff) | |
download | barebox-5c83ce6091f7ec0ea25cd9c1fadbb8f3438fa2e4.tar.gz barebox-5c83ce6091f7ec0ea25cd9c1fadbb8f3438fa2e4.tar.xz |
Merge branch 'for-next/pci'
Diffstat (limited to 'drivers/of/device.c')
-rw-r--r-- | drivers/of/device.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c new file mode 100644 index 0000000000..e2c3c02d27 --- /dev/null +++ b/drivers/of/device.c @@ -0,0 +1,33 @@ +#include <common.h> +#include <of.h> + + +/** + * of_match_device - Tell if a struct device matches an of_device_id list + * @ids: array of of device match structures to search in + * @dev: the of device structure to match against + * + * Used by a driver to check whether an platform_device present in the + * system is in its list of supported devices. + */ +const struct of_device_id *of_match_device(const struct of_device_id *matches, + const struct device_d *dev) +{ + if ((!matches) || (!dev->device_node)) + return NULL; + + return of_match_node(matches, dev->device_node); +} +EXPORT_SYMBOL(of_match_device); + +const void *of_device_get_match_data(const struct device_d *dev) +{ + const struct of_device_id *match; + + match = of_match_device(dev->driver->of_compatible, dev); + if (!match) + return NULL; + + return match->data; +} +EXPORT_SYMBOL(of_device_get_match_data); |