Skip to content

Commit 13a8e0f

Browse files
Saravana Kannangregkh
authored andcommitted
Revert "driver core: Delete driver_deferred_probe_check_state()"
This reverts commit 9cbffc7. There are a few more issues to fix that have been reported in the thread for the original series [1]. We'll need to fix those before this will work. So, revert it for now. [1] - https://lore.kernel.org/lkml/[email protected]/ Fixes: 9cbffc7 ("driver core: Delete driver_deferred_probe_check_state()") Tested-by: Tony Lindgren <[email protected]> Tested-by: Peng Fan <[email protected]> Tested-by: Douglas Anderson <[email protected]> Tested-by: Alexander Stein <[email protected]> Reviewed-by: Tony Lindgren <[email protected]> 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 1c23f9e commit 13a8e0f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

drivers/base/dd.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,42 @@ static int __init deferred_probe_timeout_setup(char *str)
274274
}
275275
__setup("deferred_probe_timeout=", deferred_probe_timeout_setup);
276276

277+
/**
278+
* driver_deferred_probe_check_state() - Check deferred probe state
279+
* @dev: device to check
280+
*
281+
* Return:
282+
* * -ENODEV if initcalls have completed and modules are disabled.
283+
* * -ETIMEDOUT if the deferred probe timeout was set and has expired
284+
* and modules are enabled.
285+
* * -EPROBE_DEFER in other cases.
286+
*
287+
* Drivers or subsystems can opt-in to calling this function instead of directly
288+
* returning -EPROBE_DEFER.
289+
*/
290+
int driver_deferred_probe_check_state(struct device *dev)
291+
{
292+
if (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) {
293+
dev_warn(dev, "ignoring dependency for device, assuming no driver\n");
294+
return -ENODEV;
295+
}
296+
297+
if (!driver_deferred_probe_timeout && initcalls_done) {
298+
dev_warn(dev, "deferred probe timeout, ignoring dependency\n");
299+
return -ETIMEDOUT;
300+
}
301+
302+
return -EPROBE_DEFER;
303+
}
304+
EXPORT_SYMBOL_GPL(driver_deferred_probe_check_state);
305+
277306
static void deferred_probe_timeout_work_func(struct work_struct *work)
278307
{
279308
struct device_private *p;
280309

281310
fw_devlink_drivers_done();
282311

312+
driver_deferred_probe_timeout = 0;
283313
driver_deferred_probe_trigger();
284314
flush_work(&deferred_probe_work);
285315

include/linux/device/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev)
242242

243243
extern int driver_deferred_probe_timeout;
244244
void driver_deferred_probe_add(struct device *dev);
245+
int driver_deferred_probe_check_state(struct device *dev);
245246
void driver_init(void);
246247

247248
/**

0 commit comments

Comments
 (0)