mirror of https://github.com/torvalds/linux.git
driver core: Export get_dev_from_fwnode()
It has turned out get_dev_from_fwnode() is useful at a few other places outside of the driver core, as in gpiolib.c for example. Therefore let's make it available as a common helper function. Suggested-by: Saravana Kannan <saravanak@google.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Colibri iMX8X Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # TI AM62A,Xilinx ZynqMP ZCU106 Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250701114733.636510-18-ulf.hansson@linaro.org
This commit is contained in:
parent
29ea33866d
commit
9a4681a485
|
|
@ -1881,8 +1881,6 @@ static void fw_devlink_unblock_consumers(struct device *dev)
|
||||||
device_links_write_unlock();
|
device_links_write_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev)
|
|
||||||
|
|
||||||
static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
|
static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
@ -5281,6 +5279,12 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(device_set_node);
|
EXPORT_SYMBOL_GPL(device_set_node);
|
||||||
|
|
||||||
|
struct device *get_dev_from_fwnode(struct fwnode_handle *fwnode)
|
||||||
|
{
|
||||||
|
return get_device((fwnode)->dev);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(get_dev_from_fwnode);
|
||||||
|
|
||||||
int device_match_name(struct device *dev, const void *name)
|
int device_match_name(struct device *dev, const void *name)
|
||||||
{
|
{
|
||||||
return sysfs_streq(dev_name(dev), name);
|
return sysfs_streq(dev_name(dev), name);
|
||||||
|
|
|
||||||
|
|
@ -1048,6 +1048,7 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode);
|
||||||
int device_add_of_node(struct device *dev, struct device_node *of_node);
|
int device_add_of_node(struct device *dev, struct device_node *of_node);
|
||||||
void device_remove_of_node(struct device *dev);
|
void device_remove_of_node(struct device *dev);
|
||||||
void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);
|
void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);
|
||||||
|
struct device *get_dev_from_fwnode(struct fwnode_handle *fwnode);
|
||||||
|
|
||||||
static inline struct device_node *dev_of_node(struct device *dev)
|
static inline struct device_node *dev_of_node(struct device *dev)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue