OF uses struct device's of_node field (of type struct device_node) to refer to the device's OF properties. ACPI employs the fwnode field instead. The latter is of type fwnode_handle, which is also embedded in struct device_node. The struct fwnode_handle pointer in both cases can be used as an argument for the device property API which is firmware agnostic. Also make obtaining the firmware node independent of the type of the firmware. Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> --- include/linux/property.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/property.h b/include/linux/property.h index b4b1545..294418d 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -13,7 +13,9 @@ #ifndef _LINUX_PROPERTY_H_ #define _LINUX_PROPERTY_H_ +#include <linux/device.h> #include <linux/fwnode.h> +#include <linux/of.h> #include <linux/types.h> struct device; @@ -273,4 +275,12 @@ struct fwnode_handle *fwnode_graph_get_remote_port( struct fwnode_handle *fwnode_graph_get_remote_endpoint( struct fwnode_handle *fwnode); +static inline struct fwnode_handle *device_fwnode_handle(struct device *dev) +{ + if (dev->of_node) + return of_fwnode_handle(dev->of_node); + else + return dev->fwnode; +} + #endif /* _LINUX_PROPERTY_H_ */ -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html