@@ -274,12 +274,42 @@ static int __init deferred_probe_timeout_setup(char *str)
274
274
}
275
275
__setup ("deferred_probe_timeout=" , deferred_probe_timeout_setup );
276
276
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
+
277
306
static void deferred_probe_timeout_work_func (struct work_struct * work )
278
307
{
279
308
struct device_private * p ;
280
309
281
310
fw_devlink_drivers_done ();
282
311
312
+ driver_deferred_probe_timeout = 0 ;
283
313
driver_deferred_probe_trigger ();
284
314
flush_work (& deferred_probe_work );
285
315
0 commit comments