浏览代码

of: Add of_fwnode_handle() to convert device nodes to fwnode_handle

of_fwnode_handle() returns a struct fwnode_handle of the struct
device_node. This may be used on the fwnode property API.

Use a macro instead of a function in order to support const and non-const
arguments.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Sakari Ailus 8 年之前
父节点
当前提交
67831837e0
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      include/linux/of.h

+ 4 - 0
include/linux/of.h

@@ -159,6 +159,8 @@ static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
 		container_of(fwnode, struct device_node, fwnode) : NULL;
 		container_of(fwnode, struct device_node, fwnode) : NULL;
 }
 }
 
 
+#define of_fwnode_handle(node) (&(node)->fwnode)
+
 static inline bool of_have_populated_dt(void)
 static inline bool of_have_populated_dt(void)
 {
 {
 	return of_root != NULL;
 	return of_root != NULL;
@@ -602,6 +604,8 @@ static inline struct device_node *of_find_node_with_property(
 	return NULL;
 	return NULL;
 }
 }
 
 
+#define of_fwnode_handle(node) NULL
+
 static inline bool of_have_populated_dt(void)
 static inline bool of_have_populated_dt(void)
 {
 {
 	return false;
 	return false;