linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] device property: Introduce fwnode_device_is_compatible() helper
@ 2022-10-05 14:38 Andy Shevchenko
  2022-10-05 14:38 ` [PATCH v1 2/2] soc: fsl: qe: Switch to use fwnode instead of of_node Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-10-05 14:38 UTC (permalink / raw)
  To: Andy Shevchenko, linuxppc-dev, linux-arm-kernel, linux-kernel,
	linux-acpi
  Cc: Qiang Zhao, Li Yang, Daniel Scally, Heikki Krogerus, Sakari Ailus

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>
---
 include/linux/property.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/property.h b/include/linux/property.h
index 1c26d263d5e4..4948a890b153 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -56,6 +56,11 @@ 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_device_is_compatible(const struct fwnode_handle *fwnode, const char *compat)
+{
+	return fwnode_property_match_string(fwnode, "compatible", compat) >= 0;
+}
+
 bool fwnode_property_present(const struct fwnode_handle *fwnode,
 			     const char *propname);
 int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-05 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05 14:38 [PATCH v1 1/2] device property: Introduce fwnode_device_is_compatible() helper Andy Shevchenko
2022-10-05 14:38 ` [PATCH v1 2/2] soc: fsl: qe: Switch to use fwnode instead of of_node Andy Shevchenko
2022-10-05 15:19 ` [PATCH v1 1/2] device property: Introduce fwnode_device_is_compatible() helper Andy Shevchenko
2022-10-05 16:05 ` kernel test robot
2022-10-05 16:25   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).