Commit 3cd6bab2 authored by Ulf Hansson's avatar Ulf Hansson Committed by Rob Herring

of: property: fw_devlink: Fixup behaviour when 'node_not_dev' is set

In the struct supplier_bindings the member 'node_not_dev' is described as
"The consumer node containing the property is never a device.", but that is
inconsistent with the behaviour of the code in of_link_property(), as it
calls of_get_compat_node() that starts parsing for a compatible property
from the node it gets passed to it. The proper behaviour is to start at the
node's parent, so let's do that.

While at it, let's take the opportunity to update the description of the
'node_not_dev' flag, as to clarify its purpose.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Reviewed-by: default avatarSaravana Kannan <saravanak@google.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210902090221.820254-1-ulf.hansson@linaro.org
parent 5ebea824
...@@ -1075,6 +1075,17 @@ static struct device_node *of_get_compat_node(struct device_node *np) ...@@ -1075,6 +1075,17 @@ static struct device_node *of_get_compat_node(struct device_node *np)
return np; return np;
} }
static struct device_node *of_get_compat_node_parent(struct device_node *np)
{
struct device_node *parent, *node;
parent = of_get_parent(np);
node = of_get_compat_node(parent);
of_node_put(parent);
return node;
}
/** /**
* of_link_to_phandle - Add fwnode link to supplier from supplier phandle * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
* @con_np: consumer device tree node * @con_np: consumer device tree node
...@@ -1249,7 +1260,9 @@ static struct device_node *parse_##fname(struct device_node *np, \ ...@@ -1249,7 +1260,9 @@ static struct device_node *parse_##fname(struct device_node *np, \
* @parse_prop.index: For properties holding a list of phandles, this is the * @parse_prop.index: For properties holding a list of phandles, this is the
* index into the list * index into the list
* @optional: Describes whether a supplier is mandatory or not * @optional: Describes whether a supplier is mandatory or not
* @node_not_dev: The consumer node containing the property is never a device. * @node_not_dev: The consumer node containing the property is never converted
* to a struct device. Instead, parse ancestor nodes for the
* compatible property to find a node corresponding to a device.
* *
* Returns: * Returns:
* parse_prop() return values are * parse_prop() return values are
...@@ -1424,7 +1437,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) ...@@ -1424,7 +1437,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)
struct device_node *con_dev_np; struct device_node *con_dev_np;
con_dev_np = s->node_not_dev con_dev_np = s->node_not_dev
? of_get_compat_node(con_np) ? of_get_compat_node_parent(con_np)
: of_node_get(con_np); : of_node_get(con_np);
matched = true; matched = true;
i++; i++;
......
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