lkml.org 
[lkml]   [2015]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 08/10] device property: add fwnode_is_compatible()
Date
This is being added so code that is independent of the firmware being
used can match firmware nodes to devices.

This commit only implements it for OF nodes.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---

drivers/base/property.c | 9 +++++++++
include/linux/property.h | 2 ++
2 files changed, 11 insertions(+)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 92cdbb3..9c8be31 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -585,3 +585,12 @@ const char *fwnode_get_name(struct fwnode_handle *fwnode)
return NULL;
}
EXPORT_SYMBOL_GPL(fwnode_get_name);
+
+bool fwnode_is_compatible(struct fwnode_handle *fwnode, const char *compatible)
+{
+ if (is_of_node(fwnode))
+ return of_device_is_compatible(to_of_node(fwnode), compatible);
+
+ return false;
+}
+EXPORT_SYMBOL_GPL(fwnode_is_compatible);
diff --git a/include/linux/property.h b/include/linux/property.h
index cfd1eb2..bf10074 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -80,6 +80,8 @@ const char *fwnode_get_name(struct fwnode_handle *fwnode);

void fwnode_handle_put(struct fwnode_handle *fwnode);

+bool fwnode_is_compatible(struct fwnode_handle *fwnode, const char *compatible);
+
unsigned int device_get_child_node_count(struct device *dev);

static inline bool device_property_read_bool(struct device *dev,
--
2.4.1


\
 
 \ /
  Last update: 2015-06-30 17:21    [W:0.190 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site