Skip to content

Commit 1745d29

Browse files
Saravana Kannangregkh
authored andcommitted
driver core: Reevaluate dev->links.need_for_probe as suppliers are added
A previous patch 0332450 ("driver core: Allow fwnode_operations.add_links to differentiate errors") forgot to update all call sites to fwnode_operations.add_links. This patch fixes that. Legend: -> Denotes RHS is an optional/potential supplier for LHS => Denotes RHS is a mandatory supplier for LHS Example: Device A => Device X Device A -> Device Y Before this patch: 1. Device A is added. 2. Device A is marked as waiting for mandatory suppliers 3. Device X is added 4. Device A is left marked as waiting for mandatory suppliers Step 4 is wrong since all mandatory suppliers of Device A have been added. After this patch: 1. Device A is added. 2. Device A is marked as waiting for mandatory suppliers 3. Device X is added 4. Device A is no longer considered as waiting for mandatory suppliers This is the correct behavior. Fixes: 0332450 ("driver core: Allow fwnode_operations.add_links to differentiate errors") Signed-off-by: Saravana Kannan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 99c73ce commit 1745d29

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/base/core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,13 @@ static void device_link_add_missing_supplier_links(void)
523523

524524
mutex_lock(&wfs_lock);
525525
list_for_each_entry_safe(dev, tmp, &wait_for_suppliers,
526-
links.needs_suppliers)
527-
if (!fwnode_call_int_op(dev->fwnode, add_links, dev))
526+
links.needs_suppliers) {
527+
int ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
528+
if (!ret)
528529
list_del_init(&dev->links.needs_suppliers);
530+
else if (ret != -ENODEV)
531+
dev->links.need_for_probe = false;
532+
}
529533
mutex_unlock(&wfs_lock);
530534
}
531535

0 commit comments

Comments
 (0)