Skip to contentSkip to conversation

driver-core: fix build for !CONFIG_MODULES

PATCH New Dmitry Torokhov 1 participant 1 message May 21, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver-core: fix build for !CONFIG_MODULES

Commit f2411da74698 ("driver-core: add driver module asynchronous probe support") broke build in case modules are disabled, because in this case "struct module" is not defined and we can't dereference it. Let's define module_requested_async_probing() helper and stub it out if modules are disabled.

---
 drivers/base/dd.c      |  2 +-
 include/linux/module.h | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/base/dd.c +1 -1
index 42e97d9..8da8e07 100644
@@ -427,7 +427,7 @@ bool driver_allows_async_probing(struct device_driver *drv)
 		return false;
 
 	default:
-		if (drv->owner && drv->owner->async_probe_requested)
+		if (module_requested_async_probing(drv->owner))
 			return true;
 
 		return false;
include/linux/module.h +11 -0
index 2e747e0..e6857d9 100644
@@ -510,6 +511,11 @@ int unregister_module_notifier(struct notifier_block *nb);
 
 extern void print_modules(void);
 
+static inline bool module_requested_async_probing(struct module *module)
+{
+	return module && module->async_probe_requested;
+}
+
 #else /* !CONFIG_MODULES... */
 
 /* Given an address, look for it in the exception tables. */
@@ -620,6 +626,12 @@ static inline int unregister_module_notifier(struct notifier_block *nb)
 static inline void print_modules(void)
 {
 }
+
+static inline bool module_requested_async_probing(struct module *module)
+{
+	return false;
+}
+
 #endif /* CONFIG_MODULES */
 
 #ifdef CONFIG_SYSFS
Signature · 5 lines
2.2.0.rc0.207.ga3a616c


-- 
Dmitry