IIO: clang W=1 warning cleanup.
Subsystems (6)
Jonathan Cameron
maintainercover IIO: clang W=1 warning cleanup.
From: Jonathan Cameron <[email protected]>
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
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(-)
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 1/12 iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion.
From: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- drivers/iio/accel/bma180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/bma180.c +1 -1
@@ -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];
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 2/12 iio:dc:ina2xx-adc: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- drivers/iio/adc/ina2xx-adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ina2xx-adc.c +1 -1
@@ -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];
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 3/12 iio:adc:rcar: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- drivers/iio/adc/rcar-gyroadc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/adc/rcar-gyroadc.c +1 -2
@@ -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);
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 4/12 iio:adc:ti-ads1015: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- drivers/iio/adc/ti-ads1015.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-ads1015.c +1 -1
@@ -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) {
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 5/12 iio:amplifiers:hmc425a: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- drivers/iio/amplifiers/hmc425a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/amplifiers/hmc425a.c +1 -1
@@ -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;
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 6/12 iio:dac:mcp4725: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- drivers/iio/dac/mcp4725.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/mcp4725.c +1 -1
@@ -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);
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 7/12 iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- 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(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c +1 -1
@@ -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))
drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c +1 -1
@@ -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))
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 8/12 iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- 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(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +1 -1
@@ -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)
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c +1 -1
@@ -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 ;
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 9/12 iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum conversion.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Cast to a uintptr_t rather than directly to the enum.
As per the discussion in below linked media patch.
--- drivers/iio/magnetometer/ak8975.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/magnetometer/ak8975.c +1 -1
@@ -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);
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 10/12 iio:dummy: Drop set but unused variable len.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
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).
--- drivers/iio/dummy/iio_simple_dummy_buffer.c | 2 -- 1 file changed, 2 deletions(-)
drivers/iio/dummy/iio_simple_dummy_buffer.c +0 -2
@@ -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 ; } }
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 11/12 iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
If CONFIG_PM not set then clang warns this structure is unused.
--- drivers/iio/accel/bmc150-accel-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/bmc150-accel-core.c +1 -1
@@ -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 },
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH 12/12 iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
This structure is only used in PM ops, so may not be used depending on build configuration.
--- drivers/iio/accel/kxcjk-1013.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/kxcjk-1013.c +1 -1
@@ -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 ] = {
Signature · 1 line
2.34.1
Quoted 20 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
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.
Quoted 8 lines
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.
Quoted 52 lines
Cc Arnd Bergmann <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Cc Stephan Gerhold <[email protected]>Cc Jean-Baptiste Maneyrol <[email protected]>Cc Baptiste Mansuy <[email protected]>Cc Linus Walleij <[email protected]>Cc Jonathan Albrieux <[email protected]>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_unusedas only needed with
for pm ops.
iio:accel:kxcjk-1013: Mark struct__maybe_unusedto 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(-)Signature · 1 line
2.34.1
Jonathan Cameron
maintainerQuoted 30 lines · On Mon, 6 Dec 2021 11:18:12 -0700 Nathan Chancellor <[email protected]> wrote:
Quoted 20 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
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.
Quoted 8 lines
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
Quoted 7 lines
I build tested
drivers/iio/for arm, arm64, s390, andx86_64allmodconfig 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 <[email protected]>
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
Quoted 53 lines
Quoted 53 lines
Cc Arnd Bergmann <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Cc Stephan Gerhold <[email protected]>Cc Jean-Baptiste Maneyrol <[email protected]>Cc Baptiste Mansuy <[email protected]>Cc Linus Walleij <[email protected]>Cc Jonathan Albrieux <[email protected]>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_unusedas only needed with
for pm ops.
iio:accel:kxcjk-1013: Mark struct__maybe_unusedto 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(-)Signature · 1 line
2.34.1