Commit e44bb0cb authored by Sakari Ailus's avatar Sakari Ailus Committed by Rafael J. Wysocki

device property: Make dev_fwnode() public

The function to obtain a fwnode related to a struct device is useful for
drivers that use the fwnode property API: it allows not being aware of the
underlying firmware implementation.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 67831837
...@@ -183,11 +183,12 @@ static int pset_prop_read_string(struct property_set *pset, ...@@ -183,11 +183,12 @@ static int pset_prop_read_string(struct property_set *pset,
return 0; return 0;
} }
static inline struct fwnode_handle *dev_fwnode(struct device *dev) struct fwnode_handle *dev_fwnode(struct device *dev)
{ {
return IS_ENABLED(CONFIG_OF) && dev->of_node ? return IS_ENABLED(CONFIG_OF) && dev->of_node ?
&dev->of_node->fwnode : dev->fwnode; &dev->of_node->fwnode : dev->fwnode;
} }
EXPORT_SYMBOL_GPL(dev_fwnode);
/** /**
* device_property_present - check if a property of a device is present * device_property_present - check if a property of a device is present
......
...@@ -33,6 +33,8 @@ enum dev_dma_attr { ...@@ -33,6 +33,8 @@ enum dev_dma_attr {
DEV_DMA_COHERENT, DEV_DMA_COHERENT,
}; };
struct fwnode_handle *dev_fwnode(struct device *dev);
bool device_property_present(struct device *dev, const char *propname); bool device_property_present(struct device *dev, const char *propname);
int device_property_read_u8_array(struct device *dev, const char *propname, int device_property_read_u8_array(struct device *dev, const char *propname,
u8 *val, size_t nval); u8 *val, size_t nval);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment