summaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorSaravana Kannan <saravanak@google.com>2019-10-28 15:00:24 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-02 18:05:18 +0100
commit03324507e66c7664c754b1ef92c5c3be24c78aa2 (patch)
tree4cff81a6887f21a050c1c3852afbb8a905abcb95 /drivers/base/core.c
parentbcbbcfd57247f4c2976055995e5760fb576aae1e (diff)
downloadlinux-03324507e66c7664c754b1ef92c5c3be24c78aa2.tar.gz
linux-03324507e66c7664c754b1ef92c5c3be24c78aa2.tar.bz2
linux-03324507e66c7664c754b1ef92c5c3be24c78aa2.zip
driver core: Allow fwnode_operations.add_links to differentiate errors
When add_links() still has suppliers that it needs to link to in the future, this patch allows it to differentiate between suppliers that are needed for probing vs suppliers that are needed for sync_state() correctness. Signed-off-by: Saravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/20191028220027.251605-4-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 48cd43a91ce6..e6d3e6d485da 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2297,7 +2297,7 @@ int device_add(struct device *dev)
struct device *parent;
struct kobject *kobj;
struct class_interface *class_intf;
- int error = -EINVAL;
+ int error = -EINVAL, fw_ret;
struct kobject *glue_dir = NULL;
dev = get_device(dev);
@@ -2413,9 +2413,13 @@ int device_add(struct device *dev)
*/
device_link_add_missing_supplier_links();
- if (fwnode_has_op(dev->fwnode, add_links)
- && fwnode_call_int_op(dev->fwnode, add_links, dev))
- device_link_wait_for_mandatory_supplier(dev, true);
+ if (fwnode_has_op(dev->fwnode, add_links)) {
+ fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
+ if (fw_ret == -ENODEV)
+ device_link_wait_for_mandatory_supplier(dev);
+ else if (fw_ret)
+ device_link_wait_for_optional_supplier(dev);
+ }
bus_probe_device(dev);
if (parent)