Skip to content

Commit 00b2475

Browse files
Saravana Kannangregkh
authored andcommitted
driver core: Fix handling of fw_devlink=permissive
When commit 8375e74 ("driver core: Add fw_devlink kernel commandline option") added fw_devlink, it didn't implement "permissive" mode correctly. That commit got the device links flags correct to make sure unprobed suppliers don't block the probing of a consumer. However, if a consumer is waiting for mandatory suppliers to register, that could still block a consumer from probing. This commit fixes that by making sure in permissive mode, all suppliers to a consumer are treated as a optional suppliers. So, even if a consumer is waiting for suppliers to register and link itself (using the DL_FLAG_SYNC_STATE_ONLY flag) to the supplier, the consumer is never blocked from probing. Fixes: 8375e74 ("driver core: Add fw_devlink kernel commandline option") Reported-by: Marek Szyprowski <[email protected]> Signed-off-by: Saravana Kannan <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3740d93 commit 00b2475

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/base/core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,11 @@ u32 fw_devlink_get_flags(void)
23702370
return fw_devlink_flags;
23712371
}
23722372

2373+
static bool fw_devlink_is_permissive(void)
2374+
{
2375+
return fw_devlink_flags == DL_FLAG_SYNC_STATE_ONLY;
2376+
}
2377+
23732378
/**
23742379
* device_add - add device to device hierarchy.
23752380
* @dev: device.
@@ -2524,7 +2529,7 @@ int device_add(struct device *dev)
25242529
if (fw_devlink_flags && is_fwnode_dev &&
25252530
fwnode_has_op(dev->fwnode, add_links)) {
25262531
fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
2527-
if (fw_ret == -ENODEV)
2532+
if (fw_ret == -ENODEV && !fw_devlink_is_permissive())
25282533
device_link_wait_for_mandatory_supplier(dev);
25292534
else if (fw_ret)
25302535
device_link_wait_for_optional_supplier(dev);

0 commit comments

Comments
 (0)