[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221009162155.1318-4-soha@lohu.info>
Date: Mon, 10 Oct 2022 00:21:55 +0800
From: Soha Jin <soha@...u.info>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
linux-kernel@...r.kernel.org, Soha Jin <soha@...u.info>
Subject: [PATCH 3/3] device property: add fwnode_is_compatible() for compatible match
fwnode_is_compatible is a shortcut to check if a device is compatible with
a compat string in fwnode property "compatible". This function is similar
to of_device_is_compatible.
Signed-off-by: Soha Jin <soha@...u.info>
---
include/linux/property.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/property.h b/include/linux/property.h
index dbe747f3e3be..776e4a8bc379 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -252,6 +252,13 @@ fwnode_property_string_array_count(const struct fwnode_handle *fwnode,
return fwnode_property_read_string_array(fwnode, propname, NULL, 0);
}
+static inline bool fwnode_is_compatible(const struct fwnode_handle *fwnode,
+ const char *compat)
+{
+ return fwnode_property_match_string_nocase(fwnode, "compatible",
+ compat) >= 0;
+}
+
struct software_node;
/**
--
2.30.2
Powered by blists - more mailing lists