diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2011-01-05 07:27:04 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-01-23 23:02:52 -0500 |
commit | b75be4204e7871869b2c268c00783703197aaa7d (patch) | |
tree | 6667a6d0ca0380bf8f64a499bfcee0db39bdc5a6 /include | |
parent | 3b90a5b292321b2acac3921f77046ae195aef53f (diff) |
param: add null statement to compiled-in module params
Add an unused struct declaration statement requiring a
terminating semicolon to the compile-in case to provoke an
error if __MODULE_INFO() is used without the terminating
semicolon. Previously MODULE_ALIAS("foo") (no semicolon)
compiled fine if MODULE was not selected.
Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/moduleparam.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 112adf8bd47d..07b41951e3fa 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -16,15 +16,17 @@ | |||
16 | /* Chosen so that structs with an unsigned long line up. */ | 16 | /* Chosen so that structs with an unsigned long line up. */ |
17 | #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) | 17 | #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) |
18 | 18 | ||
19 | #ifdef MODULE | ||
20 | #define ___module_cat(a,b) __mod_ ## a ## b | 19 | #define ___module_cat(a,b) __mod_ ## a ## b |
21 | #define __module_cat(a,b) ___module_cat(a,b) | 20 | #define __module_cat(a,b) ___module_cat(a,b) |
21 | #ifdef MODULE | ||
22 | #define __MODULE_INFO(tag, name, info) \ | 22 | #define __MODULE_INFO(tag, name, info) \ |
23 | static const char __module_cat(name,__LINE__)[] \ | 23 | static const char __module_cat(name,__LINE__)[] \ |
24 | __used __attribute__((section(".modinfo"), unused, aligned(1))) \ | 24 | __used __attribute__((section(".modinfo"), unused, aligned(1))) \ |
25 | = __stringify(tag) "=" info | 25 | = __stringify(tag) "=" info |
26 | #else /* !MODULE */ | 26 | #else /* !MODULE */ |
27 | #define __MODULE_INFO(tag, name, info) | 27 | /* This struct is here for syntactic coherency, it is not used */ |
28 | #define __MODULE_INFO(tag, name, info) \ | ||
29 | struct __module_cat(name,__LINE__) {} | ||
28 | #endif | 30 | #endif |
29 | #define __MODULE_PARM_TYPE(name, _type) \ | 31 | #define __MODULE_PARM_TYPE(name, _type) \ |
30 | __MODULE_INFO(parmtype, name##type, #name ":" _type) | 32 | __MODULE_INFO(parmtype, name##type, #name ":" _type) |