iio: remove bits_per_word = 8 assignments
Subsystems (7)
David Lechner
reviewercover iio: remove bits_per_word = 8 assignments
While grepping the IIO subsystem for drivers that set bits_per_word to unusual values to check for potential bugs, I found it to be a bit of a nuisance that 2/3s of the matches were setting it to the default value of 8. So here is a series removing the unnecessary assignments.
---
David Lechner (14):
iio: adc: ad4030: remove bits_per_word = 8
iio: adc: ti-tsc2046: remove bits_per_word = 8
iio: chemical: bme680_spi: remove bits_per_word = 8
iio: dac: ad5761: remove bits_per_word = 8
iio: dac: ad5766: remove bits_per_word = 8
iio: dac: ad5791: remove bits_per_word = 8
iio: dac: ltc2688: remove bits_per_word = 8
iio: gyro: adxrs450: remove bits_per_word = 8
iio: imu: adis: remove bits_per_word = 8
iio: magnetometer: hmc5843_spi: remove bits_per_word = 8
iio: magnetometer: rm3100-spi: remove bits_per_word = 8
iio: pressure: bmp280-spi: remove bits_per_word = 8
iio: pressure: ms5611_spi: remove bits_per_word = 8
iio: pressure: zpa2326_spi: remove bits_per_word = 8
drivers/iio/adc/ad4030.c | 4 ---- drivers/iio/adc/ti-tsc2046.c | 1 - drivers/iio/chemical/bme680_spi.c | 8 -------- drivers/iio/dac/ad5761.c | 2 -- drivers/iio/dac/ad5766.c | 2 -- drivers/iio/dac/ad5791.c | 2 -- drivers/iio/dac/ltc2688.c | 2 -- drivers/iio/gyro/adxrs450.c | 5 ----- drivers/iio/imu/adis.c | 9 --------- drivers/iio/imu/adis_buffer.c | 3 --- drivers/iio/magnetometer/hmc5843_spi.c | 1 - drivers/iio/magnetometer/rm3100-spi.c | 1 - drivers/iio/pressure/bmp280-spi.c | 8 -------- drivers/iio/pressure/ms5611_spi.c | 1 - drivers/iio/pressure/zpa2326_spi.c | 1 - 15 files changed, 50 deletions(-)
---
base-commit: 7e9a82ab5b861d3c33c99a22c1245a5b262ee502
change-id: 20250505-iio-remove-bits_per_word-8-db80654b1c17
Best regards,
Signature · 1 line
David Lechner <[email protected]>
David Lechner
reviewerPATCH 1/14 iio: adc: ad4030: remove bits_per_word = 8
Remove setting bits_per_word = 8 from the ad4030 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/adc/ad4030.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/iio/adc/ad4030.c +0 -4
@@ -244,7 +244,6 @@ static int ad4030_enter_config_mode(struct ad4030_state *st)struct spi_transfer xfer = { .tx_buf = st->tx_data, - .bits_per_word =8 , .len =1 , .speed_hz =AD4030_SPI_MAX_REG_XFER_SPEED , };
@@ -260,7 +259,6 @@ static int ad4030_exit_config_mode(struct ad4030_state *st)struct spi_transfer xfer = { .tx_buf = st->tx_data, - .bits_per_word =8 , .len =3 , .speed_hz =AD4030_SPI_MAX_REG_XFER_SPEED , };
@@ -276,7 +274,6 @@ static int ad4030_spi_read(void *context, const void *reg, size_t reg_size,struct spi_transfer xfer = { .tx_buf = st->tx_data, .rx_buf = st->rx_data.raw, - .bits_per_word =8 , .len = reg_size + val_size, .speed_hz =AD4030_SPI_MAX_REG_XFER_SPEED , };
@@ -311,7 +308,6 @@ static int ad4030_spi_write(void *context, const void *data, size_t count) ((u8 *)data)[2 ] ==0x81 ;struct spi_transfer xfer = { .tx_buf = st->tx_data, - .bits_per_word =8 , .len = count, .speed_hz =AD4030_SPI_MAX_REG_XFER_SPEED , };
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 2/14 iio: adc: ti-tsc2046: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the ti-tsc2046 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/adc/ti-tsc2046.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/adc/ti-tsc2046.c +0 -1
@@ -761,7 +761,6 @@ static int tsc2046_adc_probe(struct spi_device *spi)if (!dcfg)return -EINVAL ; - spi->bits_per_word =8 ; spi->mode &= ~SPI_MODE_X_MASK ; spi->mode |=SPI_MODE_0 ; ret =spi_setup (spi);
Signature · 1 line
2.43.0
Re: [PATCH 02/14] iio: adc: ti-tsc2046: remove bits_per_word = 8
Quoted 5 lines · David Lechner
Remove setting
bits_per_word= 8 from the ti-tsc2046 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.Signed-off-by David Lechner <[email protected]>
Thank you!
Best Regards,
Oleksij
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
David Lechner
reviewerPATCH 3/14 iio: chemical: bme680_spi: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the bme680 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
Since no other SPI settings are changed, we can also remove the call to spi_setup().
--- drivers/iio/chemical/bme680_spi.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/iio/chemical/bme680_spi.c +0 -8
@@ -112,14 +112,6 @@ static int bme680_spi_probe(struct spi_device *spi)const struct spi_device_id *id =spi_get_device_id (spi);struct bme680_spi_bus_context *bus_context;struct regmap *regmap; -int ret; - - spi->bits_per_word =8 ; - ret =spi_setup (spi); -if (ret <0 ) { -dev_err (&spi->dev,"spi_setup failed!\n" ); -return ret; - } bus_context =devm_kzalloc (&spi->dev,sizeof (*bus_context),GFP_KERNEL );if (!bus_context)
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 4/14 iio: dac: ad5761: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the ad5761 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/dac/ad5761.c | 2 -- 1 file changed, 2 deletions(-)
drivers/iio/dac/ad5761.c +0 -2
@@ -137,13 +137,11 @@ static int _ad5761_spi_read(struct ad5761_state *st, u8 addr, u16 *val)struct spi_transfer xfers[] = { { .tx_buf = &st->data[0 ].d8[1 ], - .bits_per_word =8 , .len =3 , .cs_change = true, }, { .tx_buf = &st->data[1 ].d8[1 ], .rx_buf = &st->data[2 ].d8[1 ], - .bits_per_word =8 , .len =3 , }, };
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 5/14 iio: dac: ad5766: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the ad5766 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/dac/ad5766.c | 2 -- 1 file changed, 2 deletions(-)
drivers/iio/dac/ad5766.c +0 -2
@@ -148,13 +148,11 @@ static int __ad5766_spi_read(struct ad5766_state *st, u8 dac, int *val)struct spi_transfer xfers[] = { { .tx_buf = &st->data[0 ].d32, - .bits_per_word =8 , .len =3 , .cs_change =1 , }, { .tx_buf = &st->data[1 ].d32, .rx_buf = &st->data[2 ].d32, - .bits_per_word =8 , .len =3 , }, };
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 6/14 iio: dac: ad5791: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the ad5791 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/dac/ad5791.c | 2 -- 1 file changed, 2 deletions(-)
drivers/iio/dac/ad5791.c +0 -2
@@ -138,13 +138,11 @@ static int ad5791_spi_read(struct ad5791_state *st, u8 addr, u32 *val)struct spi_transfer xfers[] = { { .tx_buf = &st->data[0 ].d8[1 ], - .bits_per_word =8 , .len =3 , .cs_change =1 , }, { .tx_buf = &st->data[1 ].d8[1 ], .rx_buf = &st->data[2 ].d8[1 ], - .bits_per_word =8 , .len =3 , }, };
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 7/14 iio: dac: ltc2688: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the ltc2688 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/dac/ltc2688.c | 2 -- 1 file changed, 2 deletions(-)
drivers/iio/dac/ltc2688.c +0 -2
@@ -104,13 +104,11 @@ static int ltc2688_spi_read(void *context, const void *reg, size_t reg_size,struct spi_transfer xfers[] = { { .tx_buf = st->tx_data, - .bits_per_word =8 , .len = reg_size + val_size, .cs_change =1 , }, { .tx_buf = st->tx_data +3 , .rx_buf = st->rx_data, - .bits_per_word =8 , .len = reg_size + val_size, }, };
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 8/14 iio: gyro: adxrs450: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the adxrs450 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/gyro/adxrs450.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/iio/gyro/adxrs450.c +0 -5
@@ -95,12 +95,10 @@ static int adxrs450_spi_read_reg_16(struct iio_dev *indio_dev,struct spi_transfer xfers[] = { { .tx_buf = &st->tx, - .bits_per_word =8 , .len =sizeof (st->tx), .cs_change =1 , }, { .rx_buf = &st->rx, - .bits_per_word =8 , .len =sizeof (st->rx), }, };
@@ -169,12 +167,10 @@ static int adxrs450_spi_sensor_data(struct iio_dev *indio_dev, s16 *val)struct spi_transfer xfers[] = { { .tx_buf = &st->tx, - .bits_per_word =8 , .len =sizeof (st->tx), .cs_change =1 , }, { .rx_buf = &st->rx, - .bits_per_word =8 , .len =sizeof (st->rx), }, };
@@ -209,7 +205,6 @@ static int adxrs450_spi_initial(struct adxrs450_state *st,struct spi_transfer xfers = { .tx_buf = &st->tx, .rx_buf = &st->rx, - .bits_per_word =8 , .len =sizeof (st->tx), };
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 9/14 iio: imu: adis: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the adis driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/imu/adis.c | 9 --------- drivers/iio/imu/adis_buffer.c | 3 --- 2 files changed, 12 deletions(-)
drivers/iio/imu/adis.c +0 -9
@@ -39,34 +39,29 @@ int __adis_write_reg(struct adis *adis, unsigned int reg, unsigned int value,struct spi_transfer xfers[] = { { .tx_buf = adis->tx, - .bits_per_word =8 , .len =2 , .cs_change =1 , .delay.value = adis->data->write_delay, .delay.unit =SPI_DELAY_UNIT_USECS , }, { .tx_buf = adis->tx +2 , - .bits_per_word =8 , .len =2 , .cs_change =1 , .delay.value = adis->data->write_delay, .delay.unit =SPI_DELAY_UNIT_USECS , }, { .tx_buf = adis->tx +4 , - .bits_per_word =8 , .len =2 , .cs_change =1 , .delay.value = adis->data->write_delay, .delay.unit =SPI_DELAY_UNIT_USECS , }, { .tx_buf = adis->tx +6 , - .bits_per_word =8 , .len =2 , .delay.value = adis->data->write_delay, .delay.unit =SPI_DELAY_UNIT_USECS , }, { .tx_buf = adis->tx +8 , - .bits_per_word =8 , .len =2 , .delay.value = adis->data->write_delay, .delay.unit =SPI_DELAY_UNIT_USECS ,
@@ -133,14 +128,12 @@ int __adis_read_reg(struct adis *adis, unsigned int reg, unsigned int *val,struct spi_transfer xfers[] = { { .tx_buf = adis->tx, - .bits_per_word =8 , .len =2 , .cs_change =1 , .delay.value = adis->data->write_delay, .delay.unit =SPI_DELAY_UNIT_USECS , }, { .tx_buf = adis->tx +2 , - .bits_per_word =8 , .len =2 , .cs_change =1 , .delay.value = adis->data->read_delay,
@@ -148,14 +141,12 @@ int __adis_read_reg(struct adis *adis, unsigned int reg, unsigned int *val, }, { .tx_buf = adis->tx + 4, .rx_buf = adis->rx, - .bits_per_word = 8, .len = 2, .cs_change = 1, .delay.value = adis->data->read_delay, .delay.unit = SPI_DELAY_UNIT_USECS, }, { .rx_buf = adis->rx + 2, - .bits_per_word = 8, .len = 2, .delay.value = adis->data->read_delay, .delay.unit = SPI_DELAY_UNIT_USECS,
drivers/iio/imu/adis_buffer.c +0 -3
@@ -49,12 +49,10 @@ static int adis_update_scan_mode_burst(struct iio_dev *indio_dev, tx[1 ] =0 ; adis->xfer[0 ].tx_buf = tx; - adis->xfer[0 ].bits_per_word =8 ; adis->xfer[0 ].len =2 ;if (adis->data->burst_max_speed_hz) adis->xfer[0 ].speed_hz = adis->data->burst_max_speed_hz; adis->xfer[1 ].rx_buf = adis->buffer; - adis->xfer[1 ].bits_per_word =8 ; adis->xfer[1 ].len = burst_length;if (adis->data->burst_max_speed_hz) adis->xfer[1 ].speed_hz = adis->data->burst_max_speed_hz;
@@ -100,7 +98,6 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,spi_message_init (&adis->msg);for (j =0 ; j <= scan_count; j++) { - adis->xfer[j].bits_per_word =8 ;if (j != scan_count) adis->xfer[j].cs_change =1 ; adis->xfer[j].len =2 ;
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 10/14 iio: magnetometer: hmc5843_spi: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the hmc5843 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/magnetometer/hmc5843_spi.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/magnetometer/hmc5843_spi.c +0 -1
@@ -60,7 +60,6 @@ static int hmc5843_spi_probe(struct spi_device *spi) spi->mode =SPI_MODE_3 ; spi->max_speed_hz =8000000 ; - spi->bits_per_word =8 ; ret =spi_setup (spi);if (ret)return ret;
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 11/14 iio: magnetometer: rm3100-spi: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the rm3100 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/magnetometer/rm3100-spi.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/magnetometer/rm3100-spi.c +0 -1
@@ -32,7 +32,6 @@ static int rm3100_probe(struct spi_device *spi) spi->mode =SPI_MODE_0 ;/* Data rates cannot exceed 1Mbits. */ spi->max_speed_hz =1000000 ; - spi->bits_per_word =8 ; ret =spi_setup (spi);if (ret)return ret;
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 12/14 iio: pressure: bmp280-spi: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the bmp280 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
Since no other SPI settings are changed, we can also remove the call to spi_setup().
--- drivers/iio/pressure/bmp280-spi.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/iio/pressure/bmp280-spi.c +0 -8
@@ -81,14 +81,6 @@ static int bmp280_spi_probe(struct spi_device *spi)const struct bmp280_chip_info *chip_info;struct regmap_bus const *bmp_regmap_bus;struct regmap *regmap; -int ret; - - spi->bits_per_word =8 ; - ret =spi_setup (spi); -if (ret <0 ) { -dev_err (&spi->dev,"spi_setup failed!\n" ); -return ret; - } chip_info =spi_get_device_match_data (spi);
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 13/14 iio: pressure: ms5611_spi: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the ms5611 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/pressure/ms5611_spi.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/pressure/ms5611_spi.c +0 -1
@@ -92,7 +92,6 @@ static int ms5611_spi_probe(struct spi_device *spi) spi->mode =SPI_MODE_0 ; spi->max_speed_hz =min (spi->max_speed_hz,20000000U ); - spi->bits_per_word =8 ; ret =spi_setup (spi);if (ret <0 )return ret;
Signature · 1 line
2.43.0
David Lechner
reviewerPATCH 14/14 iio: pressure: zpa2326_spi: remove bits_per_word = 8
In reply to David LechnerRemove setting bits_per_word = 8 from the zpa2326 driver. This is the default value for SPI transfers, so it is not necessary to explicitly set it.
--- drivers/iio/pressure/zpa2326_spi.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/pressure/zpa2326_spi.c +0 -1
@@ -47,7 +47,6 @@ static int zpa2326_probe_spi(struct spi_device *spi)*/ spi->mode =SPI_MODE_3 ; spi->max_speed_hz =min (spi->max_speed_hz,1000000U ); - spi->bits_per_word =8 ; err =spi_setup (spi);if (err <0 )return err;
Signature · 1 line
2.43.0
Quoted 6 lines · David Lechner
While grepping the IIO subsystem for drivers that set
bits_per_wordto unusual values to check for potential bugs, I found it to be a bit of a nuisance that 2/3s of the matches were setting it to the default value of 8. So here is a series removing the unnecessary assignments.---
LGTM,
Quoted 37 lines
David Lechner (14):
iio: adc: ad4030: removebits_per_word= 8
iio: adc: ti-tsc2046: removebits_per_word= 8
iio: chemical:bme680_spi: removebits_per_word= 8
iio: dac: ad5761: removebits_per_word= 8
iio: dac: ad5766: removebits_per_word= 8
iio: dac: ad5791: removebits_per_word= 8
iio: dac: ltc2688: removebits_per_word= 8
iio: gyro: adxrs450: removebits_per_word= 8
iio: imu: adis: removebits_per_word= 8
iio: magnetometer:hmc5843_spi: removebits_per_word= 8
iio: magnetometer: rm3100-spi: removebits_per_word= 8
iio: pressure: bmp280-spi: removebits_per_word= 8
iio: pressure:ms5611_spi: removebits_per_word= 8
iio: pressure:zpa2326_spi: removebits_per_word= 8drivers/iio/adc/ad4030.c | 4 ---- drivers/iio/adc/ti-tsc2046.c | 1 - drivers/iio/chemical/bme680_spi.c | 8 --------
drivers/iio/dac/ad5761.c | 2 -- drivers/iio/dac/ad5766.c | 2 -- drivers/iio/dac/ad5791.c | 2 --drivers/iio/dac/ltc2688.c | 2 -- drivers/iio/gyro/adxrs450.c | 5 ----- drivers/iio/imu/adis.c | 9 --------- drivers/iio/imu/adis_buffer.c | 3 ---
drivers/iio/magnetometer/hmc5843_spi.c| 1 - drivers/iio/magnetometer/rm3100-spi.c | 1 - drivers/iio/pressure/bmp280-spi.c | 8 -------- drivers/iio/pressure/ms5611_spi.c | 1 - drivers/iio/pressure/zpa2326_spi.c | 1 -15 files changed, 50 deletions(-)---
base-commit:7e9a82ab5b861d3c33c99a22c1245a5b262ee502
change-id: 20250505-iio-remove-bits_per_word-8-db80654b1c17Best regards,
Quoted 11 lines · On Wed, 07 May 2025 07:28:12 +0100 Nuno Sá <[email protected]> wrote:
Quoted 6 lines · David Lechner
While grepping the IIO subsystem for drivers that set
bits_per_wordto unusual values to check for potential bugs, I found it to be a bit of a nuisance that 2/3s of the matches were setting it to the default value of 8. So here is a series removing the unnecessary assignments.---
LGTM,
Reviewed-by Nuno Sá <[email protected]>
Applied. Still time to comment if we missed anything though as for now just pushed out for 0-day to poke at.
Thanks,
Jonathan
Quoted 39 lines
Quoted 38 lines
David Lechner (14):
iio: adc: ad4030: removebits_per_word= 8
iio: adc: ti-tsc2046: removebits_per_word= 8
iio: chemical:bme680_spi: removebits_per_word= 8
iio: dac: ad5761: removebits_per_word= 8
iio: dac: ad5766: removebits_per_word= 8
iio: dac: ad5791: removebits_per_word= 8
iio: dac: ltc2688: removebits_per_word= 8
iio: gyro: adxrs450: removebits_per_word= 8
iio: imu: adis: removebits_per_word= 8
iio: magnetometer:hmc5843_spi: removebits_per_word= 8
iio: magnetometer: rm3100-spi: removebits_per_word= 8
iio: pressure: bmp280-spi: removebits_per_word= 8
iio: pressure:ms5611_spi: removebits_per_word= 8
iio: pressure:zpa2326_spi: removebits_per_word= 8drivers/iio/adc/ad4030.c | 4 ---- drivers/iio/adc/ti-tsc2046.c | 1 - drivers/iio/chemical/bme680_spi.c | 8 --------
drivers/iio/dac/ad5761.c | 2 -- drivers/iio/dac/ad5766.c | 2 -- drivers/iio/dac/ad5791.c | 2 --drivers/iio/dac/ltc2688.c | 2 -- drivers/iio/gyro/adxrs450.c | 5 ----- drivers/iio/imu/adis.c | 9 --------- drivers/iio/imu/adis_buffer.c | 3 ---
drivers/iio/magnetometer/hmc5843_spi.c| 1 - drivers/iio/magnetometer/rm3100-spi.c | 1 - drivers/iio/pressure/bmp280-spi.c | 8 -------- drivers/iio/pressure/ms5611_spi.c | 1 - drivers/iio/pressure/zpa2326_spi.c | 1 -15 files changed, 50 deletions(-)---
base-commit:7e9a82ab5b861d3c33c99a22c1245a5b262ee502
change-id: 20250505-iio-remove-bits_per_word-8-db80654b1c17Best regards,