linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] IIO: clang W=1 warning cleanup.
@ 2021-11-28 17:24 Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 01/12] iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion Jonathan Cameron
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab,
	Stephan Gerhold, Jean-Baptiste Maneyrol, Baptiste Mansuy,
	Linus Walleij, Jonathan Albrieux

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Hi All,

In the interests of noise reduction in warnings during build tests of
new code, this series suppresses a bunch of warnings seen with
LLVM=1 W=1.

Note I am seeing two others I haven't fixed here.  One is tied up in
the existing CONFIG_PM* cleanup patch set and will be dealt with as
part of that.  The other in tsl2772 looks like it might be a bug that
needs further analysis. If anyone is curious:

drivers/iio/light/tsl2772.c:576:24: warning: variable 'prox_diode_mask' set but not used [-Wunused-but-set-variable]
        int i, ret, num_leds, prox_diode_mask;     

As is common with series like this, some of the drivers are old
and as such I haven't cc'd original authors etc and would appreciate
a sanity check from anyone who has the time.

Mauro and Arnd are cc'd on a bunch of them because a media patch that
I happened to see had similar fixes + discussion of type to use in the
casting. For some others I've just picked on people who touched
the driver in last year or so.

Nothing in this series should have any functional affect.

Jonathan

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: Baptiste Mansuy <bmansuy@invensense.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>

Jonathan Cameron (12):
  iio:accel:bma180: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:dc:ina2xx-adc: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:adc:rcar: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:adc:ti-ads1015: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:amplifiers:hmc425a: Suppress clang W=1 warning about pointer to
    enum conversion.
  iio:dac:mcp4725: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum
    conversion.
  iio:dummy: Drop set but unused variable len.
  iio:accel:bmc150: Mark structure __maybe_unused as only needed with
    for pm ops.
  iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.

 drivers/iio/accel/bma180.c                      | 2 +-
 drivers/iio/accel/bmc150-accel-core.c           | 2 +-
 drivers/iio/accel/kxcjk-1013.c                  | 2 +-
 drivers/iio/adc/ina2xx-adc.c                    | 2 +-
 drivers/iio/adc/rcar-gyroadc.c                  | 3 +--
 drivers/iio/adc/ti-ads1015.c                    | 2 +-
 drivers/iio/amplifiers/hmc425a.c                | 2 +-
 drivers/iio/dac/mcp4725.c                       | 2 +-
 drivers/iio/dummy/iio_simple_dummy_buffer.c     | 2 --
 drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 2 +-
 drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c       | 2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c       | 2 +-
 drivers/iio/magnetometer/ak8975.c               | 2 +-
 14 files changed, 13 insertions(+), 16 deletions(-)

-- 
2.34.1


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

* [PATCH 01/12] iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 02/12] iio:dc:ina2xx-adc: " Jonathan Cameron
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab,
	Stephan Gerhold

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/iio/accel/bma180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 09496f358ad9..d8a454c266d5 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -938,7 +938,7 @@ static int bma180_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, indio_dev);
 	data->client = client;
 	if (client->dev.of_node)
-		chip = (enum chip_ids)of_device_get_match_data(dev);
+		chip = (uintptr_t)of_device_get_match_data(dev);
 	else
 		chip = id->driver_data;
 	data->part_info = &bma180_part_info[chip];
-- 
2.34.1


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

* [PATCH 02/12] iio:dc:ina2xx-adc: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 01/12] iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 03/12] iio:adc:rcar: " Jonathan Cameron
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/iio/adc/ina2xx-adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
index 352f27657238..3bea3ade6ff1 100644
--- a/drivers/iio/adc/ina2xx-adc.c
+++ b/drivers/iio/adc/ina2xx-adc.c
@@ -971,7 +971,7 @@ static int ina2xx_probe(struct i2c_client *client,
 	}
 
 	if (client->dev.of_node)
-		type = (enum ina2xx_ids)of_device_get_match_data(&client->dev);
+		type = (uintptr_t)of_device_get_match_data(&client->dev);
 	else
 		type = id->driver_data;
 	chip->config = &ina2xx_config[type];
-- 
2.34.1


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

* [PATCH 03/12] iio:adc:rcar: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 01/12] iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 02/12] iio:dc:ina2xx-adc: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 04/12] iio:adc:ti-ads1015: " Jonathan Cameron
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/iio/adc/rcar-gyroadc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
index a48895046408..727ea6c68049 100644
--- a/drivers/iio/adc/rcar-gyroadc.c
+++ b/drivers/iio/adc/rcar-gyroadc.c
@@ -511,8 +511,7 @@ static int rcar_gyroadc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	priv->model = (enum rcar_gyroadc_model)
-		of_device_get_match_data(&pdev->dev);
+	priv->model = (uintptr_t)of_device_get_match_data(&pdev->dev);
 
 	platform_set_drvdata(pdev, indio_dev);
 
-- 
2.34.1


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

* [PATCH 04/12] iio:adc:ti-ads1015: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (2 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 03/12] iio:adc:rcar: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 05/12] iio:amplifiers:hmc425a: " Jonathan Cameron
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/iio/adc/ti-ads1015.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index b92d4cd1b823..068efbce1710 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -950,7 +950,7 @@ static int ads1015_probe(struct i2c_client *client,
 	indio_dev->name = ADS1015_DRV_NAME;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	chip = (enum chip_ids)device_get_match_data(&client->dev);
+	chip = (uintptr_t)device_get_match_data(&client->dev);
 	if (chip == ADSXXXX)
 		chip = id->driver_data;
 	switch (chip) {
-- 
2.34.1


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

* [PATCH 05/12] iio:amplifiers:hmc425a: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (3 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 04/12] iio:adc:ti-ads1015: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 06/12] iio:dac:mcp4725: " Jonathan Cameron
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/iio/amplifiers/hmc425a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc425a.c
index 9efa692151f0..16c0a77f6a1c 100644
--- a/drivers/iio/amplifiers/hmc425a.c
+++ b/drivers/iio/amplifiers/hmc425a.c
@@ -192,7 +192,7 @@ static int hmc425a_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	st = iio_priv(indio_dev);
-	st->type = (enum hmc425a_type)of_device_get_match_data(&pdev->dev);
+	st->type = (uintptr_t)of_device_get_match_data(&pdev->dev);
 
 	st->chip_info = &hmc425a_chip_info_tbl[st->type];
 	indio_dev->num_channels = st->chip_info->num_channels;
-- 
2.34.1


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

* [PATCH 06/12] iio:dac:mcp4725: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (4 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 05/12] iio:amplifiers:hmc425a: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 07/12] iio:imu:inv_icm42600: " Jonathan Cameron
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 drivers/iio/dac/mcp4725.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
index 98b2c2f10bf3..842bad57cb88 100644
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -386,7 +386,7 @@ static int mcp4725_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, indio_dev);
 	data->client = client;
 	if (dev_fwnode(&client->dev))
-		data->id = (enum chip_id)device_get_match_data(&client->dev);
+		data->id = (uintptr_t)device_get_match_data(&client->dev);
 	else
 		data->id = id->driver_data;
 	pdata = dev_get_platdata(&client->dev);
-- 
2.34.1


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

* [PATCH 07/12] iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (5 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 06/12] iio:dac:mcp4725: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 08/12] iio:imu:inv_mpu6050: " Jonathan Cameron
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab,
	Jean-Baptiste Maneyrol

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
 drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 2 +-
 drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
index 85b1934cec60..33d9afb1ba91 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
@@ -58,7 +58,7 @@ static int inv_icm42600_probe(struct i2c_client *client)
 	match = device_get_match_data(&client->dev);
 	if (!match)
 		return -EINVAL;
-	chip = (enum inv_icm42600_chip)match;
+	chip = (uintptr_t)match;
 
 	regmap = devm_regmap_init_i2c(client, &inv_icm42600_regmap_config);
 	if (IS_ERR(regmap))
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
index 323789697a08..e6305e5fa975 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
@@ -57,7 +57,7 @@ static int inv_icm42600_probe(struct spi_device *spi)
 	match = device_get_match_data(&spi->dev);
 	if (!match)
 		return -EINVAL;
-	chip = (enum inv_icm42600_chip)match;
+	chip = (uintptr_t)match;
 
 	regmap = devm_regmap_init_spi(spi, &inv_icm42600_regmap_config);
 	if (IS_ERR(regmap))
-- 
2.34.1


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

* [PATCH 08/12] iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (6 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 07/12] iio:imu:inv_icm42600: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 09/12] iio:magn:ak8975: " Jonathan Cameron
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab,
	Baptiste Mansuy, Jean-Baptiste Maneyrol, Linus Walleij

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Baptiste Mansuy <bmansuy@invensense.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 3ef17e3f50e2..fe03707ec2d3 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -110,7 +110,7 @@ static int inv_mpu_probe(struct i2c_client *client,
 
 	match = device_get_match_data(&client->dev);
 	if (match) {
-		chip_type = (enum inv_devices)match;
+		chip_type = (uintptr_t)match;
 		name = client->name;
 	} else if (id) {
 		chip_type = (enum inv_devices)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index b056f3fe2561..6800356b25fb 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -45,7 +45,7 @@ static int inv_mpu_probe(struct spi_device *spi)
 		chip_type = (enum inv_devices)spi_id->driver_data;
 		name = spi_id->name;
 	} else if ((match = device_get_match_data(&spi->dev))) {
-		chip_type = (enum inv_devices)match;
+		chip_type = (uintptr_t)match;
 		name = dev_name(&spi->dev);
 	} else {
 		return -ENODEV;
-- 
2.34.1


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

* [PATCH 09/12] iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum conversion.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (7 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 08/12] iio:imu:inv_mpu6050: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 10/12] iio:dummy: Drop set but unused variable len Jonathan Cameron
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab,
	Jonathan Albrieux, Linus Walleij

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/magnetometer/ak8975.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index 6e82dc54a417..55879a20ae52 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -929,7 +929,7 @@ static int ak8975_probe(struct i2c_client *client,
 	/* id will be NULL when enumerated via ACPI */
 	match = device_get_match_data(&client->dev);
 	if (match) {
-		chipset = (enum asahi_compass_chipset)(match);
+		chipset = (uintptr_t)match;
 		name = dev_name(&client->dev);
 	} else if (id) {
 		chipset = (enum asahi_compass_chipset)(id->driver_data);
-- 
2.34.1


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

* [PATCH 10/12] iio:dummy: Drop set but unused variable len.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (8 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 09/12] iio:magn:ak8975: " Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 11/12] iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops Jonathan Cameron
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Not sure what the thinking was here, as lost to history, but the
variable is clearly not used so get rid of it.

Warning seen with clang W=1 tests (may be present with other compilers
and build options).

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/dummy/iio_simple_dummy_buffer.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/dummy/iio_simple_dummy_buffer.c b/drivers/iio/dummy/iio_simple_dummy_buffer.c
index 59aa60d4ca37..d81c2b2dad82 100644
--- a/drivers/iio/dummy/iio_simple_dummy_buffer.c
+++ b/drivers/iio/dummy/iio_simple_dummy_buffer.c
@@ -45,7 +45,6 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
 {
 	struct iio_poll_func *pf = p;
 	struct iio_dev *indio_dev = pf->indio_dev;
-	int len = 0;
 	u16 *data;
 
 	data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
@@ -79,7 +78,6 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
 					  indio_dev->masklength, j);
 			/* random access read from the 'device' */
 			data[i] = fakedata[j];
-			len += 2;
 		}
 	}
 
-- 
2.34.1


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

* [PATCH 11/12] iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (9 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 10/12] iio:dummy: Drop set but unused variable len Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-11-28 17:24 ` [PATCH 12/12] iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning Jonathan Cameron
  2021-12-06 18:18 ` [PATCH 00/12] IIO: clang W=1 warning cleanup Nathan Chancellor
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Stephan Gerhold

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

If CONFIG_PM not set then clang warns this structure is unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/iio/accel/bmc150-accel-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
index b0678c351e82..e6081dd0a880 100644
--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -170,7 +170,7 @@ static const struct {
 				     {1000, 0, 0x0E},
 				     {2000, 0, 0x0F} };
 
-static const struct {
+static __maybe_unused const struct {
 	int bw_bits;
 	int msec;
 } bmc150_accel_sample_upd_time[] = { {0x08, 64},
-- 
2.34.1


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

* [PATCH 12/12] iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (10 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 11/12] iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops Jonathan Cameron
@ 2021-11-28 17:24 ` Jonathan Cameron
  2021-12-06 18:18 ` [PATCH 00/12] IIO: clang W=1 warning cleanup Nathan Chancellor
  12 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-11-28 17:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Stephan Gerhold

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This structure is only used in PM ops, so may not be used depending
on build configuration.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
---
 drivers/iio/accel/kxcjk-1013.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 88cf0c276893..460b1a89d575 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -315,7 +315,7 @@ static const char *const kxtf9_samp_freq_avail =
 	"25 50 100 200 400 800";
 
 /* Refer to section 4 of the specification */
-static const struct {
+static __maybe_unused const struct {
 	int odr_bits;
 	int usec;
 } odr_start_up_times[KX_MAX_CHIPS][12] = {
-- 
2.34.1


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

* Re: [PATCH 00/12] IIO: clang W=1 warning cleanup.
  2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
                   ` (11 preceding siblings ...)
  2021-11-28 17:24 ` [PATCH 12/12] iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning Jonathan Cameron
@ 2021-12-06 18:18 ` Nathan Chancellor
  2021-12-16 18:03   ` Jonathan Cameron
  12 siblings, 1 reply; 15+ messages in thread
From: Nathan Chancellor @ 2021-12-06 18:18 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab,
	Stephan Gerhold, Jean-Baptiste Maneyrol, Baptiste Mansuy,
	Linus Walleij, Jonathan Albrieux, llvm

On Sun, Nov 28, 2021 at 05:24:33PM +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Hi All,
> 
> In the interests of noise reduction in warnings during build tests of
> new code, this series suppresses a bunch of warnings seen with
> LLVM=1 W=1.
> 
> Note I am seeing two others I haven't fixed here.  One is tied up in
> the existing CONFIG_PM* cleanup patch set and will be dealt with as
> part of that.  The other in tsl2772 looks like it might be a bug that
> needs further analysis. If anyone is curious:
> 
> drivers/iio/light/tsl2772.c:576:24: warning: variable 'prox_diode_mask' set but not used [-Wunused-but-set-variable]
>         int i, ret, num_leds, prox_diode_mask;     
> 
> As is common with series like this, some of the drivers are old
> and as such I haven't cc'd original authors etc and would appreciate
> a sanity check from anyone who has the time.
> 
> Mauro and Arnd are cc'd on a bunch of them because a media patch that
> I happened to see had similar fixes + discussion of type to use in the
> casting. For some others I've just picked on people who touched
> the driver in last year or so.
> 
> Nothing in this series should have any functional affect.
> 
> Jonathan

I build tested drivers/iio/ for arm, arm64, s390, and x86_64
allmodconfig and did not see any warnings other than the ones mentioned
in the commit message.

All the fixes look reasonable for the warnings.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Cc: Stephan Gerhold <stephan@gerhold.net>
> Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
> Cc: Baptiste Mansuy <bmansuy@invensense.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
> 
> Jonathan Cameron (12):
>   iio:accel:bma180: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:dc:ina2xx-adc: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:adc:rcar: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:adc:ti-ads1015: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:amplifiers:hmc425a: Suppress clang W=1 warning about pointer to
>     enum conversion.
>   iio:dac:mcp4725: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum
>     conversion.
>   iio:dummy: Drop set but unused variable len.
>   iio:accel:bmc150: Mark structure __maybe_unused as only needed with
>     for pm ops.
>   iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.
> 
>  drivers/iio/accel/bma180.c                      | 2 +-
>  drivers/iio/accel/bmc150-accel-core.c           | 2 +-
>  drivers/iio/accel/kxcjk-1013.c                  | 2 +-
>  drivers/iio/adc/ina2xx-adc.c                    | 2 +-
>  drivers/iio/adc/rcar-gyroadc.c                  | 3 +--
>  drivers/iio/adc/ti-ads1015.c                    | 2 +-
>  drivers/iio/amplifiers/hmc425a.c                | 2 +-
>  drivers/iio/dac/mcp4725.c                       | 2 +-
>  drivers/iio/dummy/iio_simple_dummy_buffer.c     | 2 --
>  drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 2 +-
>  drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 2 +-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c       | 2 +-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c       | 2 +-
>  drivers/iio/magnetometer/ak8975.c               | 2 +-
>  14 files changed, 13 insertions(+), 16 deletions(-)
> 
> -- 
> 2.34.1
> 
> 

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

* Re: [PATCH 00/12] IIO: clang W=1 warning cleanup.
  2021-12-06 18:18 ` [PATCH 00/12] IIO: clang W=1 warning cleanup Nathan Chancellor
@ 2021-12-16 18:03   ` Jonathan Cameron
  0 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2021-12-16 18:03 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: linux-iio, Jonathan Cameron, Arnd Bergmann, Mauro Carvalho Chehab,
	Stephan Gerhold, Jean-Baptiste Maneyrol, Baptiste Mansuy,
	Linus Walleij, Jonathan Albrieux, llvm

On Mon, 6 Dec 2021 11:18:12 -0700
Nathan Chancellor <nathan@kernel.org> wrote:

> On Sun, Nov 28, 2021 at 05:24:33PM +0000, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Hi All,
> > 
> > In the interests of noise reduction in warnings during build tests of
> > new code, this series suppresses a bunch of warnings seen with
> > LLVM=1 W=1.
> > 
> > Note I am seeing two others I haven't fixed here.  One is tied up in
> > the existing CONFIG_PM* cleanup patch set and will be dealt with as
> > part of that.  The other in tsl2772 looks like it might be a bug that
> > needs further analysis. If anyone is curious:
> > 
> > drivers/iio/light/tsl2772.c:576:24: warning: variable 'prox_diode_mask' set but not used [-Wunused-but-set-variable]
> >         int i, ret, num_leds, prox_diode_mask;     
> > 
> > As is common with series like this, some of the drivers are old
> > and as such I haven't cc'd original authors etc and would appreciate
> > a sanity check from anyone who has the time.
> > 
> > Mauro and Arnd are cc'd on a bunch of them because a media patch that
> > I happened to see had similar fixes + discussion of type to use in the
> > casting. For some others I've just picked on people who touched
> > the driver in last year or so.
> > 
> > Nothing in this series should have any functional affect.
> > 
> > Jonathan  
> 
> I build tested drivers/iio/ for arm, arm64, s390, and x86_64
> allmodconfig and did not see any warnings other than the ones mentioned
> in the commit message.
> 
> All the fixes look reasonable for the warnings.
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Thanks!

Series applied to the togreg branch of iio.git and pushed out as
testing initially to see if 0-day can find anything we missed.

Thanks,

Jonathan

> 
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > Cc: Stephan Gerhold <stephan@gerhold.net>
> > Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
> > Cc: Baptiste Mansuy <bmansuy@invensense.com>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
> > 
> > Jonathan Cameron (12):
> >   iio:accel:bma180: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:dc:ina2xx-adc: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:adc:rcar: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:adc:ti-ads1015: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:amplifiers:hmc425a: Suppress clang W=1 warning about pointer to
> >     enum conversion.
> >   iio:dac:mcp4725: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum
> >     conversion.
> >   iio:dummy: Drop set but unused variable len.
> >   iio:accel:bmc150: Mark structure __maybe_unused as only needed with
> >     for pm ops.
> >   iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.
> > 
> >  drivers/iio/accel/bma180.c                      | 2 +-
> >  drivers/iio/accel/bmc150-accel-core.c           | 2 +-
> >  drivers/iio/accel/kxcjk-1013.c                  | 2 +-
> >  drivers/iio/adc/ina2xx-adc.c                    | 2 +-
> >  drivers/iio/adc/rcar-gyroadc.c                  | 3 +--
> >  drivers/iio/adc/ti-ads1015.c                    | 2 +-
> >  drivers/iio/amplifiers/hmc425a.c                | 2 +-
> >  drivers/iio/dac/mcp4725.c                       | 2 +-
> >  drivers/iio/dummy/iio_simple_dummy_buffer.c     | 2 --
> >  drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 2 +-
> >  drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 2 +-
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c       | 2 +-
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c       | 2 +-
> >  drivers/iio/magnetometer/ak8975.c               | 2 +-
> >  14 files changed, 13 insertions(+), 16 deletions(-)
> > 
> > -- 
> > 2.34.1
> > 
> >   


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

end of thread, other threads:[~2021-12-16 17:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
2021-11-28 17:24 ` [PATCH 01/12] iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion Jonathan Cameron
2021-11-28 17:24 ` [PATCH 02/12] iio:dc:ina2xx-adc: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 03/12] iio:adc:rcar: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 04/12] iio:adc:ti-ads1015: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 05/12] iio:amplifiers:hmc425a: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 06/12] iio:dac:mcp4725: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 07/12] iio:imu:inv_icm42600: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 08/12] iio:imu:inv_mpu6050: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 09/12] iio:magn:ak8975: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 10/12] iio:dummy: Drop set but unused variable len Jonathan Cameron
2021-11-28 17:24 ` [PATCH 11/12] iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops Jonathan Cameron
2021-11-28 17:24 ` [PATCH 12/12] iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning Jonathan Cameron
2021-12-06 18:18 ` [PATCH 00/12] IIO: clang W=1 warning cleanup Nathan Chancellor
2021-12-16 18:03   ` 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).