From d173a137c5bd95ee29d02705e5fa8890ef149718 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Mon, 30 Mar 2015 16:20:06 -0700 Subject: driver-core: enable drivers to opt-out of async probe There are drivers that can not be probed asynchronously. One such group is platform drivers registered with platform_driver_probe(), which expects driver's probe routine be discarded after the driver has been registered and initial binding attempt executed. Also platform_driver_probe() an error when no devices were bound to the driver, allowing failing to load such driver module altogether. Other drivers do not work well with asynchronous probing because of driver bug or not optimal driver organization. To allow using such drivers even when user requests asynchronous probing as default boot strategy, let's allow them to opt out. Signed-off-by: Luis R. Rodriguez Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/base/dd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'drivers/base') diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 7a2fa5dcead7..39292535c74e 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -419,13 +419,19 @@ int driver_probe_device(struct device_driver *drv, struct device *dev) bool driver_allows_async_probing(struct device_driver *drv) { - if (drv->probe_type == PROBE_PREFER_ASYNCHRONOUS) + switch (drv->probe_type) { + case PROBE_PREFER_ASYNCHRONOUS: return true; - if (drv->owner && drv->owner->async_probe_requested) - return true; + case PROBE_FORCE_SYNCHRONOUS: + return false; + + default: + if (drv->owner && drv->owner->async_probe_requested) + return true; - return false; + return false; + } } struct device_attach_data { -- cgit v1.2.3