summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>2008-07-19 15:57:03 +0300
committerAdrian Bunk <bunk@kernel.org>2008-07-19 15:57:03 +0300
commit63278e95f80eef7d2d9868571949c459f9b02a09 (patch)
treec8446ee4aef4b91a19b235e8d3c421c479fcc629
parent23a22510e95a7dafa38bbdd076daa0bb28b18ff8 (diff)
moduleparam: fix alpha, ia64 and ppc64 compile failures
On alpha, ia64 and ppc64 only relocations to local data can go into read-only sections. The vast majority of module parameters use the global generic param_set_*/param_get_* functions, so the 'const' attribute for struct kernel_param is not only useless, but it also causes compile failures due to 'section type conflict' in those rare cases where param_set/get are local functions. This fixes http://bugzilla.kernel.org/show_bug.cgi?id=8964 Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Signed-off-by: Adrian Bunk <bunk@kernel.org>
-rw-r--r--include/linux/moduleparam.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index b5c98c43779e..fc91485cb7ae 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -58,13 +58,23 @@ struct kparam_array
void *elem;
};
+/* On alpha, ia64 and ppc64 relocations to global data cannot go into
+ read-only sections (which is part of respective UNIX ABI on these
+ platforms). So 'const' makes no sense and even causes compile failures
+ with some compilers. */
+#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define __moduleparam_const
+#else
+#define __moduleparam_const const
+#endif
+
/* This is the fundamental function for registering boot/module
parameters. perm sets the visibility in driverfs: 000 means it's
not there, read bits mean it's readable, write bits mean it's
writable. */
#define __module_param_call(prefix, name, set, get, arg, perm) \
static char __param_str_##name[] = prefix #name; \
- static struct kernel_param const __param_##name \
+ static struct kernel_param __moduleparam_const __param_##name \
__attribute_used__ \
__attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
= { __param_str_##name, perm, set, get, arg }