diff mbox series

[v3] crypto - img-hash: Depend on OF and silence compile test warning

Message ID 20230326085027.4759-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [v3] crypto - img-hash: Depend on OF and silence compile test warning | expand

Commit Message

Krzysztof Kozlowski March 26, 2023, 8:50 a.m. UTC
The driver is specific to OF platforms (can match only via OF table),
thus add dependency on CONFIG_OF.  Mark the of_device_id table as
unused.  This also fixes W=1 warning:

  drivers/crypto/img-hash.c:930:34: error: ‘img_hash_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes since v2:
1. Do not allow compile testing without OF.

Changes since v1:
1. Rework - depend on OF and add maybe_unused.
---
 drivers/crypto/Kconfig    | 1 +
 drivers/crypto/img-hash.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Herbert Xu March 31, 2023, 10:05 a.m. UTC | #1
On Sun, Mar 26, 2023 at 10:50:27AM +0200, Krzysztof Kozlowski wrote:
> The driver is specific to OF platforms (can match only via OF table),
> thus add dependency on CONFIG_OF.  Mark the of_device_id table as
> unused.  This also fixes W=1 warning:
> 
>   drivers/crypto/img-hash.c:930:34: error: ‘img_hash_match’ defined but not used [-Werror=unused-const-variable=]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

...

> diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
> index fe93d19e3044..2be364d9f592 100644
> --- a/drivers/crypto/img-hash.c
> +++ b/drivers/crypto/img-hash.c
> @@ -927,7 +927,7 @@ static void img_hash_done_task(unsigned long data)
>  	img_hash_finish_req(hdev->req, err);
>  }
>  
> -static const struct of_device_id img_hash_match[] = {
> +static const struct of_device_id img_hash_match[] __maybe_unused = {
>  	{ .compatible = "img,hash-accelerator" },
>  	{}
>  };

I have applied this hunk as it renders the Kconfig change unnecessary.

Thanks,
diff mbox series

Patch

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 3b2516d1433f..c636fbeb2144 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -647,6 +647,7 @@  source "drivers/crypto/vmx/Kconfig"
 config CRYPTO_DEV_IMGTEC_HASH
 	tristate "Imagination Technologies hardware hash accelerator"
 	depends on MIPS || COMPILE_TEST
+	depends on OF
 	select CRYPTO_MD5
 	select CRYPTO_SHA1
 	select CRYPTO_SHA256
diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index fe93d19e3044..2be364d9f592 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -927,7 +927,7 @@  static void img_hash_done_task(unsigned long data)
 	img_hash_finish_req(hdev->req, err);
 }
 
-static const struct of_device_id img_hash_match[] = {
+static const struct of_device_id img_hash_match[] __maybe_unused = {
 	{ .compatible = "img,hash-accelerator" },
 	{}
 };