linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused
@ 2023-03-12 15:34 Krzysztof Kozlowski
  2023-03-12 15:34 ` [PATCH v2 2/3] iio: light: max44009: add missing OF device matching Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-12 15:34 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Robert Eshleman, linux-iio, linux-kernel
  Cc: Krzysztof Kozlowski

The driver can be compile tested with !CONFIG_OF making certain data
unused (of_device_id is not used for device matching):

  drivers/iio/dac/ad5755.c:865:34: error: ‘ad5755_of_match’ defined but not used [-Werror=unused-const-variable=]

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

---

Changes since v1:
1. None.

Although Jonathan expressed need of changes here, they are a bit too
invasive for me thus I am resending it only for completeness.
I understand therefore that patch might not be accepted.
---
 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 beadfa938d2d..a6dc8a0bfc29 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -862,7 +862,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" },
-- 
2.34.1


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

* [PATCH v2 2/3] iio: light: max44009: add missing OF device matching
  2023-03-12 15:34 [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused Krzysztof Kozlowski
@ 2023-03-12 15:34 ` Krzysztof Kozlowski
  2023-03-12 16:18   ` Jonathan Cameron
  2023-03-12 15:34 ` [PATCH v2 3/3] iio: proximity: sx9500: Reference ACPI and OF ID data Krzysztof Kozlowski
  2023-03-12 16:20 ` [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused Jonathan Cameron
  2 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-12 15:34 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Robert Eshleman, linux-iio, linux-kernel
  Cc: Krzysztof Kozlowski

The driver currently matches only via i2c_device_id, but also has
of_device_id table:

  drivers/iio/light/max44009.c:545:34: error: ‘max44009_of_match’ defined but not used [-Werror=unused-const-variable=]

Fixes: 6aef699a7d7e ("iio: light: add driver for MAX44009")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes since v1:
1. Drop __maybe_unused/of_match_ptr
---
 drivers/iio/light/max44009.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/max44009.c b/drivers/iio/light/max44009.c
index 3dadace09fe2..176dcad6e8e8 100644
--- a/drivers/iio/light/max44009.c
+++ b/drivers/iio/light/max44009.c
@@ -527,6 +527,12 @@ static int max44009_probe(struct i2c_client *client)
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
+static const struct of_device_id max44009_of_match[] = {
+	{ .compatible = "maxim,max44009" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, max44009_of_match);
+
 static const struct i2c_device_id max44009_id[] = {
 	{ "max44009", 0 },
 	{ }
@@ -536,18 +542,13 @@ MODULE_DEVICE_TABLE(i2c, max44009_id);
 static struct i2c_driver max44009_driver = {
 	.driver = {
 		.name = MAX44009_DRV_NAME,
+		.of_match_table = max44009_of_match,
 	},
 	.probe_new = max44009_probe,
 	.id_table = max44009_id,
 };
 module_i2c_driver(max44009_driver);
 
-static const struct of_device_id max44009_of_match[] = {
-	{ .compatible = "maxim,max44009" },
-	{ }
-};
-MODULE_DEVICE_TABLE(of, max44009_of_match);
-
 MODULE_AUTHOR("Robert Eshleman <bobbyeshleman@gmail.com>");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("MAX44009 ambient light sensor driver");
-- 
2.34.1


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

* [PATCH v2 3/3] iio: proximity: sx9500: Reference ACPI and OF ID data
  2023-03-12 15:34 [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused Krzysztof Kozlowski
  2023-03-12 15:34 ` [PATCH v2 2/3] iio: light: max44009: add missing OF device matching Krzysztof Kozlowski
@ 2023-03-12 15:34 ` Krzysztof Kozlowski
  2023-03-12 16:18   ` Jonathan Cameron
  2023-03-12 16:20 ` [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused Jonathan Cameron
  2 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-03-12 15:34 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Robert Eshleman, linux-iio, linux-kernel
  Cc: Krzysztof Kozlowski

Always reference acpi_device_id and of_device_id tables, as they is
little benefit of conditional compiling and OF table could be used also
for ACPI matching via PRP0001.  This fixes warning:

  drivers/iio/proximity/sx9500.c:1039:34: error: ‘sx9500_of_match’ defined but not used [-Werror=unused-const-variable=]

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

---

Changes since v1:
1. Drop of_match_ptr and ACPI_PTR
---
 drivers/iio/proximity/sx9500.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 8794e75e5bf9..9b2cfcade6a4 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -1051,8 +1051,8 @@ MODULE_DEVICE_TABLE(i2c, sx9500_id);
 static struct i2c_driver sx9500_driver = {
 	.driver = {
 		.name	= SX9500_DRIVER_NAME,
-		.acpi_match_table = ACPI_PTR(sx9500_acpi_match),
-		.of_match_table = of_match_ptr(sx9500_of_match),
+		.acpi_match_table = sx9500_acpi_match,
+		.of_match_table = sx9500_of_match,
 		.pm = pm_sleep_ptr(&sx9500_pm_ops),
 	},
 	.probe_new	= sx9500_probe,
-- 
2.34.1


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

* Re: [PATCH v2 2/3] iio: light: max44009: add missing OF device matching
  2023-03-12 15:34 ` [PATCH v2 2/3] iio: light: max44009: add missing OF device matching Krzysztof Kozlowski
@ 2023-03-12 16:18   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2023-03-12 16:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lars-Peter Clausen, Michael Hennerich, Robert Eshleman,
	linux-iio, linux-kernel

On Sun, 12 Mar 2023 16:34:28 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> The driver currently matches only via i2c_device_id, but also has
> of_device_id table:
> 
>   drivers/iio/light/max44009.c:545:34: error: ‘max44009_of_match’ defined but not used [-Werror=unused-const-variable=]
> 
> Fixes: 6aef699a7d7e ("iio: light: add driver for MAX44009")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
Applied to the togreg branch of iio.git.

Thanks,

Jonathan

> ---
> 
> Changes since v1:
> 1. Drop __maybe_unused/of_match_ptr
> ---
>  drivers/iio/light/max44009.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/light/max44009.c b/drivers/iio/light/max44009.c
> index 3dadace09fe2..176dcad6e8e8 100644
> --- a/drivers/iio/light/max44009.c
> +++ b/drivers/iio/light/max44009.c
> @@ -527,6 +527,12 @@ static int max44009_probe(struct i2c_client *client)
>  	return devm_iio_device_register(&client->dev, indio_dev);
>  }
>  
> +static const struct of_device_id max44009_of_match[] = {
> +	{ .compatible = "maxim,max44009" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, max44009_of_match);
> +
>  static const struct i2c_device_id max44009_id[] = {
>  	{ "max44009", 0 },
>  	{ }
> @@ -536,18 +542,13 @@ MODULE_DEVICE_TABLE(i2c, max44009_id);
>  static struct i2c_driver max44009_driver = {
>  	.driver = {
>  		.name = MAX44009_DRV_NAME,
> +		.of_match_table = max44009_of_match,
>  	},
>  	.probe_new = max44009_probe,
>  	.id_table = max44009_id,
>  };
>  module_i2c_driver(max44009_driver);
>  
> -static const struct of_device_id max44009_of_match[] = {
> -	{ .compatible = "maxim,max44009" },
> -	{ }
> -};
> -MODULE_DEVICE_TABLE(of, max44009_of_match);
> -
>  MODULE_AUTHOR("Robert Eshleman <bobbyeshleman@gmail.com>");
>  MODULE_LICENSE("GPL v2");
>  MODULE_DESCRIPTION("MAX44009 ambient light sensor driver");


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

* Re: [PATCH v2 3/3] iio: proximity: sx9500: Reference ACPI and OF ID data
  2023-03-12 15:34 ` [PATCH v2 3/3] iio: proximity: sx9500: Reference ACPI and OF ID data Krzysztof Kozlowski
@ 2023-03-12 16:18   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2023-03-12 16:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lars-Peter Clausen, Michael Hennerich, Robert Eshleman,
	linux-iio, linux-kernel

On Sun, 12 Mar 2023 16:34:29 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> Always reference acpi_device_id and of_device_id tables, as they is
> little benefit of conditional compiling and OF table could be used also
> for ACPI matching via PRP0001.  This fixes warning:
> 
>   drivers/iio/proximity/sx9500.c:1039:34: error: ‘sx9500_of_match’ defined but not used [-Werror=unused-const-variable=]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
Applied

Thanks,

Jonathan

> Changes since v1:
> 1. Drop of_match_ptr and ACPI_PTR
> ---
>  drivers/iio/proximity/sx9500.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
> index 8794e75e5bf9..9b2cfcade6a4 100644
> --- a/drivers/iio/proximity/sx9500.c
> +++ b/drivers/iio/proximity/sx9500.c
> @@ -1051,8 +1051,8 @@ MODULE_DEVICE_TABLE(i2c, sx9500_id);
>  static struct i2c_driver sx9500_driver = {
>  	.driver = {
>  		.name	= SX9500_DRIVER_NAME,
> -		.acpi_match_table = ACPI_PTR(sx9500_acpi_match),
> -		.of_match_table = of_match_ptr(sx9500_of_match),
> +		.acpi_match_table = sx9500_acpi_match,
> +		.of_match_table = sx9500_of_match,
>  		.pm = pm_sleep_ptr(&sx9500_pm_ops),
>  	},
>  	.probe_new	= sx9500_probe,


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

* Re: [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused
  2023-03-12 15:34 [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused Krzysztof Kozlowski
  2023-03-12 15:34 ` [PATCH v2 2/3] iio: light: max44009: add missing OF device matching Krzysztof Kozlowski
  2023-03-12 15:34 ` [PATCH v2 3/3] iio: proximity: sx9500: Reference ACPI and OF ID data Krzysztof Kozlowski
@ 2023-03-12 16:20 ` Jonathan Cameron
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2023-03-12 16:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lars-Peter Clausen, Michael Hennerich, Robert Eshleman,
	linux-iio, linux-kernel

On Sun, 12 Mar 2023 16:34:27 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> The driver can be compile tested with !CONFIG_OF making certain data
> unused (of_device_id is not used for device matching):
> 
>   drivers/iio/dac/ad5755.c:865:34: error: ‘ad5755_of_match’ defined but not used [-Werror=unused-const-variable=]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Changes since v1:
> 1. None.
> 
> Although Jonathan expressed need of changes here, they are a bit too
> invasive for me thus I am resending it only for completeness.
> I understand therefore that patch might not be accepted.

Hi Krzysztof,

I'll leave it unapplied for now on basis I might get time in near future
to do the more major refactor I'd like to see (and hack some testing together
for it).  If that looks unlikely I may pick this up later.

It'll sit in patchwork until then making me feel guilty :)

Thanks,

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 beadfa938d2d..a6dc8a0bfc29 100644
> --- a/drivers/iio/dac/ad5755.c
> +++ b/drivers/iio/dac/ad5755.c
> @@ -862,7 +862,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" },


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

end of thread, other threads:[~2023-03-12 16:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-12 15:34 [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused Krzysztof Kozlowski
2023-03-12 15:34 ` [PATCH v2 2/3] iio: light: max44009: add missing OF device matching Krzysztof Kozlowski
2023-03-12 16:18   ` Jonathan Cameron
2023-03-12 15:34 ` [PATCH v2 3/3] iio: proximity: sx9500: Reference ACPI and OF ID data Krzysztof Kozlowski
2023-03-12 16:18   ` Jonathan Cameron
2023-03-12 16:20 ` [PATCH v2 1/3] iio: dac: ad5755: mark OF related data as maybe unused Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).