Skip to contentSkip to conversation

module: Fix variable names

PATCH In review Andrew Zaborowski 2 participants 3 messages Nov 11, 2019 – Nov 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 module: Fix variable names

Apparently the intention was for the dependent module's name to appear in the variable name resulting from using IWD_MODULE_DEPENDS, so the dependencies all have unique names (apparently not critical).

---
 src/module.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/module.h +1 -1
index b0102cba..c0f1c6c1 100644
@@ -40,7 +40,7 @@ struct iwd_module_depends {
 
 #define IWD_MODULE_DEPENDS(name, dep)					\
 	static struct iwd_module_depends				\
-				__iwd_module__##name_##dep		\
+				__iwd_module__##name##_##dep		\
 		__attribute__((used, section("__iwd_module_dep"),       \
 					aligned(8))) = {		\
 			.self = #name,					\
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 modules: Unload modules in reverse order from loading

Make sure a module A that is needed by B is not unloaded before B.

---
 src/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/module.c +1 -1
index 9eb282f0..a8f82015 100644
@@ -173,7 +173,7 @@ void iwd_modules_exit()
 		return;
 
 	for (i = 0; i < n_modules; i++) {
-		desc = modules_sorted[i];
+		desc = modules_sorted[n_modules - 1 - i];
 		if (!desc->active)
 			continue;
 
Signature · 1 line
2.20.1
#2 lore raw
In reply to Andrew Zaborowski

Hi Andrew,

Quoted 7 lines · Andrew Zaborowski

Apparently the intention was for the dependent module's name to appear in the variable name resulting from using IWD_MODULE_DEPENDS, so the dependencies all have unique names (apparently not critical).

---
  src/module.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Both applied, thanks.

Regards,
-Denis