[PATCH] modules: fix sparse warning for every MODULE_PARM

From: Pavel Roskin
Date: Thu Oct 13 2005 - 16:39:12 EST

sparse complains about every MODULE_PARM used in a module:
warning: symbol '__parm_foo' was not declared. Should it be static?

The fix is to split declaration and initialization. While MODULE_PARM
is obsolete, it's not something sparse should report.

Signed-off-by: Pavel Roskin <proski@xxxxxxx>

diff --git a/include/linux/module.h b/include/linux/module.h
index f05372b..84d75f3 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -554,7 +554,9 @@ static inline void MODULE_PARM_(void) {
#ifdef MODULE
/* DEPRECATED: Do not use. */
#define MODULE_PARM(var,type) \
-struct obsolete_modparm __parm_##var __attribute__((section("__obsparm"))) = \
+extern struct obsolete_modparm __parm_##var \
+__attribute__((section("__obsparm"))); \
+struct obsolete_modparm __parm_##var = \
{ __stringify(var), type, &MODULE_PARM_ }; \
__MODULE_PARM_TYPE(var, type);

Pavel Roskin

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/