Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1695332 > unrolled thread

[PATCH] module: Remove const attribute from alias for MODULE_DEVICE_TABLE

Started byMatthias Kaehlcke <mka@chromium.org>
First post2017-07-25 03:30 +0200
Last post2017-07-29 23:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] module: Remove const attribute from alias for MODULE_DEVICE_TABLE Matthias Kaehlcke <mka@chromium.org> - 2017-07-25 03:30 +0200
    Re: module: Remove const attribute from alias for MODULE_DEVICE_TABLE Jessica Yu <jeyu@kernel.org> - 2017-07-29 23:50 +0200

#1695332 — [PATCH] module: Remove const attribute from alias for MODULE_DEVICE_TABLE

FromMatthias Kaehlcke <mka@chromium.org>
Date2017-07-25 03:30 +0200
Subject[PATCH] module: Remove const attribute from alias for MODULE_DEVICE_TABLE
Message-ID<u6WPE-4Ir-9@gated-at.bofh.it>
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: Matthias Kaehlcke <mka@chromium.org>
---
 include/linux/module.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index e7bdd549e527..fe5aa3736707 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -209,7 +209,7 @@ extern void cleanup_module(void);
 #ifdef MODULE
 /* Creates an alias so file2alias.c can find device table. */
 #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))))
 #else  /* !MODULE */
 #define MODULE_DEVICE_TABLE(type, name)
-- 
2.14.0.rc0.284.gd933b75aa4-goog

[toc] | [next] | [standalone]


#1699383 — Re: module: Remove const attribute from alias for MODULE_DEVICE_TABLE

FromJessica Yu <jeyu@kernel.org>
Date2017-07-29 23:50 +0200
SubjectRe: module: Remove const attribute from alias for MODULE_DEVICE_TABLE
Message-ID<u8HMu-86t-3@gated-at.bofh.it>
In reply to#1695332
+++ Matthias Kaehlcke [24/07/17 18:27 -0700]:
>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: Matthias Kaehlcke <mka@chromium.org>

Applied, thanks!

Jessica

> include/linux/module.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/include/linux/module.h b/include/linux/module.h
>index e7bdd549e527..fe5aa3736707 100644
>--- a/include/linux/module.h
>+++ b/include/linux/module.h
>@@ -209,7 +209,7 @@ extern void cleanup_module(void);
> #ifdef MODULE
> /* Creates an alias so file2alias.c can find device table. */
> #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))))
> #else  /* !MODULE */
> #define MODULE_DEVICE_TABLE(type, name)
>-- 
>2.14.0.rc0.284.gd933b75aa4-goog
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web