diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-10-05 18:29:46 +0300 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-11-02 14:09:04 +0300 |
commit | a521075d0ab389ec5e1b52a2af01ad41b3cf9792 (patch) | |
tree | 04cdd209ddfdcc219806182c5f5e96842f791a81 /include/linux/property.h | |
parent | 03e9491fff252a7435e109333ec51ca2d619b759 (diff) | |
download | linux-a521075d0ab389ec5e1b52a2af01ad41b3cf9792.tar.xz |
device property: Introduce fwnode_device_is_compatible() helper
The fwnode_device_is_compatible() helper searches for the
given string in the "compatible" string array property and,
if found, returns true.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Diffstat (limited to 'include/linux/property.h')
-rw-r--r-- | include/linux/property.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/property.h b/include/linux/property.h index 117cc200c656..67371c963134 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -50,7 +50,6 @@ int device_property_read_string(struct device *dev, const char *propname, int device_property_match_string(struct device *dev, const char *propname, const char *string); -bool fwnode_device_is_available(const struct fwnode_handle *fwnode); bool fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname); int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, @@ -72,6 +71,15 @@ int fwnode_property_read_string(const struct fwnode_handle *fwnode, const char *propname, const char **val); int fwnode_property_match_string(const struct fwnode_handle *fwnode, const char *propname, const char *string); + +bool fwnode_device_is_available(const struct fwnode_handle *fwnode); + +static inline +bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat) +{ + return fwnode_property_match_string(fwnode, "compatible", compat) >= 0; +} + int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, const char *prop, const char *nargs_prop, unsigned int nargs, unsigned int index, |