All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning
@ 2023-03-19 14:44 Krzysztof Kozlowski
  2023-03-24 10:16 ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-19 14:44 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, linux-crypto, linux-kernel
  Cc: Krzysztof Kozlowski

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 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(-)

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 3b2516d1433f..4a4aff8b16f0 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 || COMPILE_TEST
 	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" },
 	{}
 };
-- 
2.34.1


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

* Re: [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning
  2023-03-19 14:44 [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning Krzysztof Kozlowski
@ 2023-03-24 10:16 ` Herbert Xu
  2023-03-24 10:51   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2023-03-24 10:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: David S. Miller, linux-crypto, linux-kernel, Ard Biesheuvel

On Sun, Mar 19, 2023 at 03:44:39PM +0100, 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>

You should either add a dependency on OF or __maybe_unused.
Adding both makes no sense.

Anyway, what is your final goal here? If it is to get rid of
of_match_ptr because of_match_table has been unconditinoal for
over 10 years then just do it in one giant patch rather than
evaluating every single driver with of_match_table as to whether
they can be used through ACPI or not.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning
  2023-03-24 10:16 ` Herbert Xu
@ 2023-03-24 10:51   ` Krzysztof Kozlowski
  2023-03-25  5:59     ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-24 10:51 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, linux-crypto, linux-kernel, Ard Biesheuvel

On 24/03/2023 11:16, Herbert Xu wrote:
> On Sun, Mar 19, 2023 at 03:44:39PM +0100, 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>
> 
> You should either add a dependency on OF or __maybe_unused.
> Adding both makes no sense.

Of course it makes, otherwise you have warnings which is also fixed here.

> 
> Anyway, what is your final goal here? If it is to get rid of
> of_match_ptr because of_match_table has been unconditinoal for
> over 10 years then just do it in one giant patch rather than
> evaluating every single driver with of_match_table as to whether
> they can be used through ACPI or not.

My current goal is to pass compile tests. The final goal is not yet
decided because final approach is not known. Different people disagree
on details, e.g. whether ACPI && !OF should have of_device_id or not.


Best regards,
Krzysztof


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

* Re: [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning
  2023-03-24 10:51   ` Krzysztof Kozlowski
@ 2023-03-25  5:59     ` Herbert Xu
  2023-03-25 11:01       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Herbert Xu @ 2023-03-25  5:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: David S. Miller, linux-crypto, linux-kernel, Ard Biesheuvel

On Fri, Mar 24, 2023 at 11:51:43AM +0100, Krzysztof Kozlowski wrote:
>
> > You should either add a dependency on OF or __maybe_unused.
> > Adding both makes no sense.
> 
> Of course it makes, otherwise you have warnings which is also fixed here.

It won't create a warning if you depend on OF without COMPILE_TEST.

Anyway, I think adding __maybe_unused by itself is sufficient.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning
  2023-03-25  5:59     ` Herbert Xu
@ 2023-03-25 11:01       ` Krzysztof Kozlowski
  2023-03-26  2:53         ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-25 11:01 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, linux-crypto, linux-kernel, Ard Biesheuvel

On 25/03/2023 06:59, Herbert Xu wrote:
> On Fri, Mar 24, 2023 at 11:51:43AM +0100, Krzysztof Kozlowski wrote:
>>
>>> You should either add a dependency on OF or __maybe_unused.
>>> Adding both makes no sense.
>>
>> Of course it makes, otherwise you have warnings which is also fixed here.
> 
> It won't create a warning if you depend on OF without COMPILE_TEST.

In that case yes, but we want COMPILE_TEST for build coverage.

> 
> Anyway, I think adding __maybe_unused by itself is sufficient.



Best regards,
Krzysztof


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

* Re: [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning
  2023-03-25 11:01       ` Krzysztof Kozlowski
@ 2023-03-26  2:53         ` Herbert Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2023-03-26  2:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: David S. Miller, linux-crypto, linux-kernel, Ard Biesheuvel

On Sat, Mar 25, 2023 at 12:01:47PM +0100, Krzysztof Kozlowski wrote:
>
> In that case yes, but we want COMPILE_TEST for build coverage.

No we don't.  Selecting OF is trivial and even the bots will
cover this.  We have lots of drivers under crypto that depend
on COMPILE_TEST as well as OF.

> > Anyway, I think adding __maybe_unused by itself is sufficient.

If you really want to patch this driver then adding maybe_unused
is the way to go.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2023-03-26  2:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19 14:44 [PATCH v2] crypto - img-hash: Depend on OF and silence compile test warning Krzysztof Kozlowski
2023-03-24 10:16 ` Herbert Xu
2023-03-24 10:51   ` Krzysztof Kozlowski
2023-03-25  5:59     ` Herbert Xu
2023-03-25 11:01       ` Krzysztof Kozlowski
2023-03-26  2:53         ` Herbert Xu

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.