Commit 15956dad authored by Saravana Kannan's avatar Saravana Kannan Committed by Greg Kroah-Hartman

of: property: Skip adding device links to suppliers that aren't devices

Some devices need to be initialized really early and can't wait for
driver core or drivers to be functional.  These devices are typically
initialized without creating a struct device for their device nodes.

If a supplier ends up being one of these devices, skip trying to add
device links to them.
Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20191028220027.251605-6-saravanak@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0ff5cc1e
...@@ -1024,6 +1024,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, ...@@ -1024,6 +1024,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
struct device *sup_dev; struct device *sup_dev;
int ret = 0; int ret = 0;
struct device_node *tmp_np = sup_np; struct device_node *tmp_np = sup_np;
int is_populated;
of_node_get(sup_np); of_node_get(sup_np);
/* /*
...@@ -1048,9 +1049,10 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, ...@@ -1048,9 +1049,10 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
return -EINVAL; return -EINVAL;
} }
sup_dev = get_dev_from_fwnode(&sup_np->fwnode); sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
is_populated = of_node_check_flag(sup_np, OF_POPULATED);
of_node_put(sup_np); of_node_put(sup_np);
if (!sup_dev) if (!sup_dev)
return -EAGAIN; return is_populated ? 0 : -EAGAIN;
if (!device_link_add(dev, sup_dev, dl_flags)) if (!device_link_add(dev, sup_dev, dl_flags))
ret = -EAGAIN; ret = -EAGAIN;
put_device(sup_dev); put_device(sup_dev);
......
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