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

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: default avatarSaravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20191028220027.251605-4-saravanak@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bcbbcfd5
...@@ -2297,7 +2297,7 @@ int device_add(struct device *dev) ...@@ -2297,7 +2297,7 @@ int device_add(struct device *dev)
struct device *parent; struct device *parent;
struct kobject *kobj; struct kobject *kobj;
struct class_interface *class_intf; struct class_interface *class_intf;
int error = -EINVAL; int error = -EINVAL, fw_ret;
struct kobject *glue_dir = NULL; struct kobject *glue_dir = NULL;
dev = get_device(dev); dev = get_device(dev);
...@@ -2413,9 +2413,13 @@ int device_add(struct device *dev) ...@@ -2413,9 +2413,13 @@ int device_add(struct device *dev)
*/ */
device_link_add_missing_supplier_links(); device_link_add_missing_supplier_links();
if (fwnode_has_op(dev->fwnode, add_links) if (fwnode_has_op(dev->fwnode, add_links)) {
&& fwnode_call_int_op(dev->fwnode, add_links, dev)) fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
device_link_wait_for_mandatory_supplier(dev, true); 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); bus_probe_device(dev);
if (parent) if (parent)
......
...@@ -94,10 +94,15 @@ struct fwnode_reference_args { ...@@ -94,10 +94,15 @@ struct fwnode_reference_args {
* available suppliers. * available suppliers.
* *
* Return 0 if device links have been successfully created to all * Return 0 if device links have been successfully created to all
* the suppliers of this device or if the supplier information is * the suppliers this device needs to create device links to or if
* not known. Return an error if and only if the supplier * the supplier information is not known.
* information is known but some of the suppliers are not yet *
* available to create device links to. * Return -ENODEV if and only if the suppliers needed for probing
* the device are not yet available to create device links to.
*
* Return -EAGAIN if there are suppliers that need to be linked to
* that are not yet available but none of those suppliers are
* necessary for probing this device.
*/ */
struct fwnode_operations { struct fwnode_operations {
struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
......
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