[PATCH 20/20] device property: Implement fwnode_get_next_parent() using fwnode interface

Sakari Ailus
2017-02-23T17:08:35Z

fwnode_get_next_parent() can be implemented using fwnode interface. Do
that to avoid implementing an additional callback for the function in
struct fwnode_operations.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/base/property.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index f108469..6ee8f4f 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -838,17 +838,9 @@ EXPORT_SYMBOL_GPL(device_add_properties);
*/
struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode)
{
- struct fwnode_handle *parent = NULL;
+ struct fwnode_handle *parent = fwnode_call_ptr_op(fwnode, get_parent);

- if (is_of_node(fwnode)) {
- struct device_node *node;
-
- node = of_get_next_parent(to_of_node(fwnode));
- if (node)
- parent = &node->fwnode;
- } else if (is_acpi_node(fwnode)) {
- parent = acpi_node_get_parent(fwnode);
- }
+ fwnode_handle_put(fwnode);

return parent;
}
--
2.7.4