cpufeature: avoid warning when compiling with clang
Subsystems (2)
PATCH 1/2 cpufeature: avoid warning when compiling with clang
The table id (second) argument to MODULE_DEVICE_TABLE is often referenced otherwise. This is not the case for CPU features. This leads to warnings when building the kernel with Clang:
arch/arm/crypto/aes-ce-glue.c:450:1: warning: variable
'cpu_feature_match_AES' is not needed and will not be emitted [-Wunneeded-internal-declaration]
module_cpu_feature_match(AES, aes_init);
^
Avoid warnings by using __maybe_unused, similar to commit 1f318a8bafcf ("modules: mark __inittest/__exittest as __maybe_unused").
--- include/linux/cpufeature.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/cpufeature.h +1 -1
@@ -45,7 +45,7 @@* 'asm/cpufeature.h' of your favorite architecture. */ #define module_cpu_feature_match (x, __initfunc) \ -static struct cpu_feature const cpu_feature_match_ ## x[] = \ +static struct cpu_feature const __maybe_unused cpu_feature_match_ ## x[] = \ { { .feature = cpu_feature(x) }, { } }; \ MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \ \
Signature · 1 line
2.19.0
PATCH 2/2 crypto: arm/crc32 - avoid warning when compiling with Clang
The table id (second) argument to MODULE_DEVICE_TABLE is often referenced otherwise. This is not the case for CPU features. This leads to a warning when building the kernel with Clang:
arch/arm/crypto/crc32-ce-glue.c:239:33: warning: variable
'crc32_cpu_feature' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct cpu_feature crc32_cpu_feature[] = {
^Avoid warnings by using __maybe_unused, similar to commit 1f318a8bafcf ("modules: mark __inittest/__exittest as __maybe_unused").
--- arch/arm/crypto/crc32-ce-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/crypto/crc32-ce-glue.c +1 -1
@@ -236,7 +236,7 @@ static void __exit crc32_pmull_mod_exit(void) ARRAY_SIZE(crc32_pmull_algs)); } -static const struct cpu_feature crc32_cpu_feature[] = { +static const struct cpu_feature __maybe_unused crc32_cpu_feature[] = { {cpu_feature (CRC32 ) }, {cpu_feature (PMULL ) }, { } };MODULE_DEVICE_TABLE (cpu, crc32_cpu_feature);
Signature · 1 line
2.19.0
Re: [PATCH 2/2] crypto: arm/crc32 - avoid warning when compiling with Clang
Quoted 6 lines · Stefan Agner
The table id (second) argument to
MODULE_DEVICE_TABLEis often referenced otherwise. This is not the case for CPU features. This leads to a warning when building the kernel with Clang:
arch/arm/crypto/crc32-ce-glue.c:239:33: warning: variable
'crc32_cpu_feature' is not needed and will not be emitted [-Wunneeded-internal-declaration]
Quoted 8 lines
static const struct cpu_feature crc32_cpu_feature[] = { ^Avoid warnings by using
__maybe_unused, similar to commit1f318a8bafcf("modules: mark __inittest/__exittest as__maybe_unused").Fixes 2a9faf8b7e43 ("crypto: arm/crc32 - enable module autoloading based on CPU feature bits")Signed-off-by Stefan Agner <[email protected]>
Quoted 20 lines
--- arch/arm/crypto/crc32-ce-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/crypto/crc32-ce-glue.c +1
-2@@ -236,7 +236,7 @@ static void __exit crc32_pmull_mod_exit(void) ARRAY_SIZE(crc32_pmull_algs)); } -static const struct cpu_feature crc32_cpu_feature[] = { +static const struct cpu_feature __maybe_unused crc32_cpu_feature[] = { {cpu_feature (CRC32 ) }, {cpu_feature (PMULL ) }, { } };MODULE_DEVICE_TABLE (cpu, crc32_cpu_feature); --2.19.0
Quoted 9 lines · Stefan Agner
The table id (second) argument to
MODULE_DEVICE_TABLEis often referenced otherwise. This is not the case for CPU features. This leads to warnings when building the kernel with Clang:
arch/arm/crypto/aes-ce-glue.c:450:1: warning: variable
'cpu_feature_match_AES' is not needed and will not be emitted [-Wunneeded-internal-declaration]
module_cpu_feature_match(AES, aes_init);
^
Quoted 5 lines
Avoid warnings by using
__maybe_unused, similar to commit1f318a8bafcf("modules: mark __inittest/__exittest as__maybe_unused").Fixes 67bad2fdb754 ("cpu: add generic support for CPU feature based module autoloading")Signed-off-by Stefan Agner <[email protected]>
Quoted 20 lines
--- include/linux/cpufeature.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/cpufeature.h +1
-2@@ -45,7 +45,7 @@* 'asm/cpufeature.h' of your favorite architecture. */ #define module_cpu_feature_match (x, __initfunc) \ -static struct cpu_feature const cpu_feature_match_ ## x[] = \ +static struct cpu_feature const __maybe_unused cpu_feature_match_ ## x[] = \ { { .feature = cpu_feature(x) }, { } }; \ MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \ \ --2.19.0
Herbert Xu
maintainerQuoted 9 lines · Stefan Agner
The table id (second) argument to
MODULE_DEVICE_TABLEis often referenced otherwise. This is not the case for CPU features. This leads to warnings when building the kernel with Clang:
arch/arm/crypto/aes-ce-glue.c:450:1: warning: variable
'cpu_feature_match_AES' is not needed and will not be emitted [-Wunneeded-internal-declaration]
module_cpu_feature_match(AES, aes_init);
^
Quoted 8 lines
Avoid warnings by using
__maybe_unused, similar to commit1f318a8bafcf("modules: mark __inittest/__exittest as__maybe_unused").Fixes 67bad2fdb754 ("cpu: add generic support for CPU feature based module autoloading")Signed-off-by Stefan Agner <[email protected]>--- include/linux/cpufeature.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt