[v2,2/2] iio: proximity: isl29501: make use of of_device_id table

Message ID 20240225201654.49450-2-krzysztof.kozlowski@linaro.org
State New
Headers
Series [v2,1/2] iio: dac: ad5755: make use of of_device_id table |

Commit Message

Krzysztof Kozlowski Feb. 25, 2024, 8:16 p.m. UTC
  Reference the of_device_id table in the driver structure, so it will be
used for module autoloading and device matching.  This fixes clang W=1
warning:

  isl29501.c:999:34: error: unused variable 'isl29501_i2c_matches' [-Werror,-Wunused-const-variable]

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

---

Rework according to comments.

An old v1:
https://lore.kernel.org/all/20230810111933.205619-1-krzysztof.kozlowski@linaro.org/
---
 drivers/iio/proximity/isl29501.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Jonathan Cameron Feb. 26, 2024, 7:27 p.m. UTC | #1
On Sun, 25 Feb 2024 21:16:54 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> Reference the of_device_id table in the driver structure, so it will be
> used for module autoloading and device matching.  This fixes clang W=1
> warning:
> 
>   isl29501.c:999:34: error: unused variable 'isl29501_i2c_matches' [-Werror,-Wunused-const-variable]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Applied just patch 2.

Thanks,

Jonathan
> 
> ---
> 
> Rework according to comments.
> 
> An old v1:
> https://lore.kernel.org/all/20230810111933.205619-1-krzysztof.kozlowski@linaro.org/
> ---
>  drivers/iio/proximity/isl29501.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c
> index bcebacaf3dab..4982686fb4c3 100644
> --- a/drivers/iio/proximity/isl29501.c
> +++ b/drivers/iio/proximity/isl29501.c
> @@ -995,17 +995,16 @@ static const struct i2c_device_id isl29501_id[] = {
>  
>  MODULE_DEVICE_TABLE(i2c, isl29501_id);
>  
> -#if defined(CONFIG_OF)
>  static const struct of_device_id isl29501_i2c_matches[] = {
>  	{ .compatible = "renesas,isl29501" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, isl29501_i2c_matches);
> -#endif
>  
>  static struct i2c_driver isl29501_driver = {
>  	.driver = {
>  		.name	= "isl29501",
> +		.of_match_table = isl29501_i2c_matches,
>  	},
>  	.id_table	= isl29501_id,
>  	.probe		= isl29501_probe,
  

Patch

diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c
index bcebacaf3dab..4982686fb4c3 100644
--- a/drivers/iio/proximity/isl29501.c
+++ b/drivers/iio/proximity/isl29501.c
@@ -995,17 +995,16 @@  static const struct i2c_device_id isl29501_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, isl29501_id);
 
-#if defined(CONFIG_OF)
 static const struct of_device_id isl29501_i2c_matches[] = {
 	{ .compatible = "renesas,isl29501" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, isl29501_i2c_matches);
-#endif
 
 static struct i2c_driver isl29501_driver = {
 	.driver = {
 		.name	= "isl29501",
+		.of_match_table = isl29501_i2c_matches,
 	},
 	.id_table	= isl29501_id,
 	.probe		= isl29501_probe,