diff mbox series

[v1,2/3] device property: Implement device_is_compatible()

Message ID 20230609152507.77649-3-andriy.shevchenko@linux.intel.com
State New
Headers show
Series device property: Introduce device_is_compatible() | expand

Commit Message

Andy Shevchenko June 9, 2023, 3:25 p.m. UTC
Some users want to use the struct device pointer to see if
the device is compatible. Provide inline helpers for them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/property.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Greg KH June 9, 2023, 3:33 p.m. UTC | #1
On Fri, Jun 09, 2023 at 06:25:06PM +0300, Andy Shevchenko wrote:
> Some users want to use the struct device pointer to see if
> the device is compatible. Provide inline helpers for them.

What do you mean by "compatible"?

thanks,

greg k-h
diff mbox series

Patch

diff --git a/include/linux/property.h b/include/linux/property.h
index 695053c60306..8de2c707818a 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -85,6 +85,11 @@  bool fwnode_device_is_compatible(const struct fwnode_handle *fwnode, const char
 	return fwnode_property_match_string(fwnode, "compatible", compat) >= 0;
 }
 
+static inline bool device_is_compatible(const struct device *dev, const char *compat)
+{
+	return fwnode_device_is_compatible(dev_fwnode(dev), compat);
+}
+
 int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode,
 				       const char *prop, const char *nargs_prop,
 				       unsigned int nargs, unsigned int index,