All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature
@ 2021-05-27  6:28 ` Austin Kim
  0 siblings, 0 replies; 6+ messages in thread
From: Austin Kim @ 2021-05-27  6:28 UTC (permalink / raw)
  To: herbert, davem, catalin.marinas, will, john.johansen, jmorris, serge
  Cc: linux-kernel, linux-arm-kernel, linux-security-module,
	linux-crypto, austindh.kim, austin.kim

GCC compiler complains with below messages.

   warning: ‘ghash_cpu_feature’ defined but not used [-Wunused-const-variable=]
   static const struct cpu_feature ghash_cpu_feature[] = {
			    ^~~~~~~~~~~~~~~~~

The variable with MODULE_DEVICE_TABLE() is registered as platform_driver.
But ghash_cpu_feature is not used, so remove ghash_cpu_feature.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
 arch/arm64/crypto/ghash-ce-glue.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index 720cd3a58da3..c3f27d0d5329 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -615,10 +615,5 @@ static void __exit ghash_ce_mod_exit(void)
 		crypto_unregister_shash(&ghash_alg);
 }
 
-static const struct cpu_feature ghash_cpu_feature[] = {
-	{ cpu_feature(PMULL) }, { }
-};
-MODULE_DEVICE_TABLE(cpu, ghash_cpu_feature);
-
 module_init(ghash_ce_mod_init);
 module_exit(ghash_ce_mod_exit);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature
@ 2021-05-27  6:28 ` Austin Kim
  0 siblings, 0 replies; 6+ messages in thread
From: Austin Kim @ 2021-05-27  6:28 UTC (permalink / raw)
  To: herbert, davem, catalin.marinas, will, john.johansen, jmorris, serge
  Cc: linux-kernel, linux-arm-kernel, linux-security-module,
	linux-crypto, austindh.kim, austin.kim

GCC compiler complains with below messages.

   warning: ‘ghash_cpu_feature’ defined but not used [-Wunused-const-variable=]
   static const struct cpu_feature ghash_cpu_feature[] = {
			    ^~~~~~~~~~~~~~~~~

The variable with MODULE_DEVICE_TABLE() is registered as platform_driver.
But ghash_cpu_feature is not used, so remove ghash_cpu_feature.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
 arch/arm64/crypto/ghash-ce-glue.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index 720cd3a58da3..c3f27d0d5329 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -615,10 +615,5 @@ static void __exit ghash_ce_mod_exit(void)
 		crypto_unregister_shash(&ghash_alg);
 }
 
-static const struct cpu_feature ghash_cpu_feature[] = {
-	{ cpu_feature(PMULL) }, { }
-};
-MODULE_DEVICE_TABLE(cpu, ghash_cpu_feature);
-
 module_init(ghash_ce_mod_init);
 module_exit(ghash_ce_mod_exit);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature
  2021-05-27  6:28 ` Austin Kim
@ 2021-05-27 17:46   ` Eric Biggers
  -1 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2021-05-27 17:46 UTC (permalink / raw)
  To: Austin Kim
  Cc: herbert, davem, catalin.marinas, will, john.johansen, jmorris,
	serge, linux-kernel, linux-arm-kernel, linux-security-module,
	linux-crypto, austin.kim

On Thu, May 27, 2021 at 07:28:09AM +0100, Austin Kim wrote:
> 
> The variable with MODULE_DEVICE_TABLE() is registered as platform_driver.

What does this mean?  There is no platform_driver involved here at all.

> But ghash_cpu_feature is not used, so remove ghash_cpu_feature.

It is used when the file is built as a module.

> diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
> index 720cd3a58da3..c3f27d0d5329 100644
> --- a/arch/arm64/crypto/ghash-ce-glue.c
> +++ b/arch/arm64/crypto/ghash-ce-glue.c
> @@ -615,10 +615,5 @@ static void __exit ghash_ce_mod_exit(void)
>  		crypto_unregister_shash(&ghash_alg);
>  }
>  
> -static const struct cpu_feature ghash_cpu_feature[] = {
> -	{ cpu_feature(PMULL) }, { }
> -};
> -MODULE_DEVICE_TABLE(cpu, ghash_cpu_feature);
> -

Probably adding __maybe_unused to ghash_cpu_feature[] is the right thing to do.
That's what module_cpu_feature_match() does.

(Note that module_cpu_feature_match() can't be used here, as it seems the intent
is for this module to be autoloaded when PMULL is detected, but still be
loadable without it.  So, that's apparently the reason for using
MODULE_DEVICE_TABLE() directly.)

- Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature
@ 2021-05-27 17:46   ` Eric Biggers
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2021-05-27 17:46 UTC (permalink / raw)
  To: Austin Kim
  Cc: herbert, davem, catalin.marinas, will, john.johansen, jmorris,
	serge, linux-kernel, linux-arm-kernel, linux-security-module,
	linux-crypto, austin.kim

On Thu, May 27, 2021 at 07:28:09AM +0100, Austin Kim wrote:
> 
> The variable with MODULE_DEVICE_TABLE() is registered as platform_driver.

What does this mean?  There is no platform_driver involved here at all.

> But ghash_cpu_feature is not used, so remove ghash_cpu_feature.

It is used when the file is built as a module.

> diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
> index 720cd3a58da3..c3f27d0d5329 100644
> --- a/arch/arm64/crypto/ghash-ce-glue.c
> +++ b/arch/arm64/crypto/ghash-ce-glue.c
> @@ -615,10 +615,5 @@ static void __exit ghash_ce_mod_exit(void)
>  		crypto_unregister_shash(&ghash_alg);
>  }
>  
> -static const struct cpu_feature ghash_cpu_feature[] = {
> -	{ cpu_feature(PMULL) }, { }
> -};
> -MODULE_DEVICE_TABLE(cpu, ghash_cpu_feature);
> -

Probably adding __maybe_unused to ghash_cpu_feature[] is the right thing to do.
That's what module_cpu_feature_match() does.

(Note that module_cpu_feature_match() can't be used here, as it seems the intent
is for this module to be autoloaded when PMULL is detected, but still be
loadable without it.  So, that's apparently the reason for using
MODULE_DEVICE_TABLE() directly.)

- Eric

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature
  2021-05-27 17:46   ` Eric Biggers
@ 2021-05-28 13:51     ` Austin Kim
  -1 siblings, 0 replies; 6+ messages in thread
From: Austin Kim @ 2021-05-28 13:51 UTC (permalink / raw)
  To: Eric Biggers
  Cc: herbert, davem, catalin.marinas, will, John Johansen, jmorris,
	serge, linux-kernel, linux-arm-kernel, linux-security-module,
	linux-crypto, 김동현

2021년 5월 28일 (금) 오전 2:46, Eric Biggers <ebiggers@kernel.org>님이 작성:
>
> On Thu, May 27, 2021 at 07:28:09AM +0100, Austin Kim wrote:
> >
> > The variable with MODULE_DEVICE_TABLE() is registered as platform_driver.
>
> What does this mean?  There is no platform_driver involved here at all.
>

What I would like to say is "in many cases, MODULE_DEVICE_TABLE is
registered as struct of platform_driver"
ex) [drivers/char/hw_random/meson-rng.c]
MODULE_DEVICE_TABLE(of, meson_rng_of_match);

static struct platform_driver meson_rng_driver = {
.probe = meson_rng_probe,
.driver = {
.name = "meson-rng",
.of_match_table = meson_rng_of_match,
},
};

> > But ghash_cpu_feature is not used, so remove ghash_cpu_feature.
>
> It is used when the file is built as a module.
>

Thanks for the information. But it looks like this file is compiled
as built-in with 'CONFIG_CRYPTO_GHASH_ARM64_CE=y' by default.

> > diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
> > index 720cd3a58da3..c3f27d0d5329 100644
>>[...]
>
> Probably adding __maybe_unused to ghash_cpu_feature[] is the right thing to do.
> That's what module_cpu_feature_match() does.
>
> (Note that module_cpu_feature_match() can't be used here, as it seems the intent
> is for this module to be autoloaded when PMULL is detected, but still be
> loadable without it.  So, that's apparently the reason for using
> MODULE_DEVICE_TABLE() directly.)

Thanks for the valuable idea and feedback.

>
> - Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature
@ 2021-05-28 13:51     ` Austin Kim
  0 siblings, 0 replies; 6+ messages in thread
From: Austin Kim @ 2021-05-28 13:51 UTC (permalink / raw)
  To: Eric Biggers
  Cc: herbert, davem, catalin.marinas, will, John Johansen, jmorris,
	serge, linux-kernel, linux-arm-kernel, linux-security-module,
	linux-crypto, 김동현

2021년 5월 28일 (금) 오전 2:46, Eric Biggers <ebiggers@kernel.org>님이 작성:
>
> On Thu, May 27, 2021 at 07:28:09AM +0100, Austin Kim wrote:
> >
> > The variable with MODULE_DEVICE_TABLE() is registered as platform_driver.
>
> What does this mean?  There is no platform_driver involved here at all.
>

What I would like to say is "in many cases, MODULE_DEVICE_TABLE is
registered as struct of platform_driver"
ex) [drivers/char/hw_random/meson-rng.c]
MODULE_DEVICE_TABLE(of, meson_rng_of_match);

static struct platform_driver meson_rng_driver = {
.probe = meson_rng_probe,
.driver = {
.name = "meson-rng",
.of_match_table = meson_rng_of_match,
},
};

> > But ghash_cpu_feature is not used, so remove ghash_cpu_feature.
>
> It is used when the file is built as a module.
>

Thanks for the information. But it looks like this file is compiled
as built-in with 'CONFIG_CRYPTO_GHASH_ARM64_CE=y' by default.

> > diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
> > index 720cd3a58da3..c3f27d0d5329 100644
>>[...]
>
> Probably adding __maybe_unused to ghash_cpu_feature[] is the right thing to do.
> That's what module_cpu_feature_match() does.
>
> (Note that module_cpu_feature_match() can't be used here, as it seems the intent
> is for this module to be autoloaded when PMULL is detected, but still be
> loadable without it.  So, that's apparently the reason for using
> MODULE_DEVICE_TABLE() directly.)

Thanks for the valuable idea and feedback.

>
> - Eric

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-28 13:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27  6:28 [PATCH] crypto: arm64/gcm - remove Wunused-const-variable ghash_cpu_feature Austin Kim
2021-05-27  6:28 ` Austin Kim
2021-05-27 17:46 ` Eric Biggers
2021-05-27 17:46   ` Eric Biggers
2021-05-28 13:51   ` Austin Kim
2021-05-28 13:51     ` Austin Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.