Commit 0bf8bf50 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Jessica Yu

module: Remove const attribute from alias for MODULE_DEVICE_TABLE

MODULE_DEVICE_TABLE(type, name) creates an alias of type 'extern const
typeof(name)'. If 'name' is already constant the 'const' attribute is
specified twice, which is not allowed in C89 (see discussion at
https://lkml.org/lkml/2017/5/23/1440). Since the kernel is built with
-std=gnu89 clang generates warnings like this:

drivers/thermal/x86_pkg_temp_thermal.c:509:1: warning: duplicate 'const'
  declaration specifier
      [-Wduplicate-decl-specifier]
MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids);
^
./include/linux/module.h:212:8: note: expanded from macro 'MODULE_DEVICE_TABLE'
extern const typeof(name) __mod_##type##__##name##_device_table

Remove the const attribute from the alias to avoid the duplicate
specifier. After all it is only an alias and the attribute shouldn't
have any effect.
Signed-off-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
parent 52796312
...@@ -209,7 +209,7 @@ extern void cleanup_module(void); ...@@ -209,7 +209,7 @@ extern void cleanup_module(void);
#ifdef MODULE #ifdef MODULE
/* Creates an alias so file2alias.c can find device table. */ /* Creates an alias so file2alias.c can find device table. */
#define MODULE_DEVICE_TABLE(type, name) \ #define MODULE_DEVICE_TABLE(type, name) \
extern const typeof(name) __mod_##type##__##name##_device_table \ extern typeof(name) __mod_##type##__##name##_device_table \
__attribute__ ((unused, alias(__stringify(name)))) __attribute__ ((unused, alias(__stringify(name))))
#else /* !MODULE */ #else /* !MODULE */
#define MODULE_DEVICE_TABLE(type, name) #define MODULE_DEVICE_TABLE(type, name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment