mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
UPSTREAM: device property: Add fwnode_get_named_child_node()
Since now we have means to enumerate all children of any fwnode even in
ACPI we can implement fwnode_get_named_child_node(). This is similar than
device_get_named_child_node() with the exception that it can be called to
any fwnode handle. Make device_get_named_child_node() call directly this
new function.
This is useful in cases where we need to be able to find child nodes which
are not direct descendants of the parent device.
(cherry-pick from 21ea73f54c)
Change-Id: I9a62aff7a9106fcf03b7ccfa67d2814fc3981350
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
This commit is contained in:
committed by
Tao Huang
parent
fe98dc2c23
commit
f22086c9d9
@@ -927,20 +927,20 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
|
||||
EXPORT_SYMBOL_GPL(device_get_next_child_node);
|
||||
|
||||
/**
|
||||
* device_get_named_child_node - Return first matching named child node handle
|
||||
* @dev: Device to find the named child node for.
|
||||
* fwnode_get_named_child_node - Return first matching named child node handle
|
||||
* @fwnode: Firmware node to find the named child node for.
|
||||
* @childname: String to match child node name against.
|
||||
*/
|
||||
struct fwnode_handle *device_get_named_child_node(struct device *dev,
|
||||
struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *fwnode,
|
||||
const char *childname)
|
||||
{
|
||||
struct fwnode_handle *child;
|
||||
|
||||
/*
|
||||
* Find first matching named child node of this device.
|
||||
* Find first matching named child node of this fwnode.
|
||||
* For ACPI this will be a data only sub-node.
|
||||
*/
|
||||
device_for_each_child_node(dev, child) {
|
||||
fwnode_for_each_child_node(fwnode, child) {
|
||||
if (is_of_node(child)) {
|
||||
if (!of_node_cmp(to_of_node(child)->name, childname))
|
||||
return child;
|
||||
@@ -952,6 +952,18 @@ struct fwnode_handle *device_get_named_child_node(struct device *dev,
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fwnode_get_named_child_node);
|
||||
|
||||
/**
|
||||
* device_get_named_child_node - Return first matching named child node handle
|
||||
* @dev: Device to find the named child node for.
|
||||
* @childname: String to match child node name against.
|
||||
*/
|
||||
struct fwnode_handle *device_get_named_child_node(struct device *dev,
|
||||
const char *childname)
|
||||
{
|
||||
return fwnode_get_named_child_node(dev_fwnode(dev), childname);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_get_named_child_node);
|
||||
|
||||
/**
|
||||
|
||||
@@ -85,6 +85,8 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
|
||||
for (child = device_get_next_child_node(dev, NULL); child; \
|
||||
child = device_get_next_child_node(dev, child))
|
||||
|
||||
struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *fwnode,
|
||||
const char *childname);
|
||||
struct fwnode_handle *device_get_named_child_node(struct device *dev,
|
||||
const char *childname);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user