From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754712AbdGYB16 (ORCPT ); Mon, 24 Jul 2017 21:27:58 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:36142 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753022AbdGYB1w (ORCPT ); Mon, 24 Jul 2017 21:27:52 -0400 From: Matthias Kaehlcke To: Jessica Yu , Rusty Russell Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , Kees Cook , Arnd Bergmann , Doug Anderson , Grant Grundler , Greg Hackmann , Michael Davidson , Nick Desaulniers , Alexander Potapenko , Bernhard.Rosenkranzer@linaro.org, Matthias Kaehlcke Subject: [PATCH] module: Remove const attribute from alias for MODULE_DEVICE_TABLE Date: Mon, 24 Jul 2017 18:27:25 -0700 Message-Id: <20170725012725.120097-1-mka@chromium.org> X-Mailer: git-send-email 2.14.0.rc0.284.gd933b75aa4-goog Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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