diff mbox series

[1/2] iio: dac: ad5755: mark OF related data as maybe unused

Message ID 20230810111933.205619-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State Changes Requested
Headers show
Series [1/2] iio: dac: ad5755: mark OF related data as maybe unused | expand

Commit Message

Krzysztof Kozlowski Aug. 10, 2023, 11:19 a.m. UTC
When compile tested with W=1 on x86_64 with driver as built-in:

  ad5755.c:866:34: error: unused variable 'ad5755_of_match' [-Werror,-Wunused-const-variable]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/iio/dac/ad5755.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Aug. 11, 2023, 3:33 p.m. UTC | #1
On Thu, 10 Aug 2023 13:19:32 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> When compile tested with W=1 on x86_64 with driver as built-in:
> 
>   ad5755.c:866:34: error: unused variable 'ad5755_of_match' [-Werror,-Wunused-const-variable]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

I'd rather see the table used as relying on the fallback path via the spi_match_id table
is fragile as two tables may not have equivalent entries in the long run.
Entry missing in the spi_driver.driver structure.

Bonus points for adding the match data to the of table and making them all pointers
there and in spi_device_id table + using spi_get_device_match_data()

Jonathan


> ---
>  drivers/iio/dac/ad5755.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> index 404865e35460..823049ce2686 100644
> --- a/drivers/iio/dac/ad5755.c
> +++ b/drivers/iio/dac/ad5755.c
> @@ -863,7 +863,7 @@ static const struct spi_device_id ad5755_id[] = {
>  };
>  MODULE_DEVICE_TABLE(spi, ad5755_id);
>  
> -static const struct of_device_id ad5755_of_match[] = {
> +static const struct of_device_id ad5755_of_match[] __maybe_unused = {
>  	{ .compatible = "adi,ad5755" },
>  	{ .compatible = "adi,ad5755-1" },
>  	{ .compatible = "adi,ad5757" },
Krzysztof Kozlowski Aug. 15, 2023, 2:04 p.m. UTC | #2
On 11/08/2023 17:33, Jonathan Cameron wrote:
> On Thu, 10 Aug 2023 13:19:32 +0200
> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> 
>> When compile tested with W=1 on x86_64 with driver as built-in:
>>
>>   ad5755.c:866:34: error: unused variable 'ad5755_of_match' [-Werror,-Wunused-const-variable]
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> I'd rather see the table used as relying on the fallback path via the spi_match_id table
> is fragile as two tables may not have equivalent entries in the long run.
> Entry missing in the spi_driver.driver structure.
> 
> Bonus points for adding the match data to the of table and making them all pointers
> there and in spi_device_id table + using spi_get_device_match_data()

... and now I remember that I already sent such patch some time ago and
you already said this to me. Uh, sorry for sending the same thing again.
I'll fix it in spare time as you described.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index 404865e35460..823049ce2686 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -863,7 +863,7 @@  static const struct spi_device_id ad5755_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, ad5755_id);
 
-static const struct of_device_id ad5755_of_match[] = {
+static const struct of_device_id ad5755_of_match[] __maybe_unused = {
 	{ .compatible = "adi,ad5755" },
 	{ .compatible = "adi,ad5755-1" },
 	{ .compatible = "adi,ad5757" },