IIO: Tidy up parameters to regmap_bulk_* calls
Subsystems (2)
[email protected]
maintainercover IIO: Tidy up parameters to regmap_bulk_* calls
From: Jonathan Cameron <[email protected]>
One of Andy Shevchenko's recent patches tidied a case of this up and a quick grep showed we had some more.
The main focus of this set is calls to regmap_bulk_read / regmap_bulk_write. Both are used with buffers of many and varied type, but as they take a void * there is never any need to cast a pointer to said buffers to anything explicitly.
Whilst I was here I used sizeof(buf) in various places to reduce the use of explicit values when we could derive it from the source / destination buffer.
This isn't remotely urgent, but I'd like to clean these out to avoid replication in future. Not I didn't go after any other unnecessary casts in the files because that would have take thought and its Sunday evening and about time for a beer.
Jonathan Cameron (6):
iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read
calls
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in
regmap_bulk_read calls
iio:chemical:bme680: Tidy up parameters to regmap_bulk_read iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions. iio:magn:mmc35240: Drop unnecessary casts of val parameter in
regmap_bulk*
iio:light:ltr501: Drop unnecessary cast of parameter in
regmap_bulk_read
drivers/iio/accel/mxc4005.c | 4 +-- drivers/iio/chemical/atlas-sensor.c | 7 ++--- drivers/iio/chemical/bme680_core.c | 36 +++++++++++++--------- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 +-- drivers/iio/light/ltr501.c | 2 +- drivers/iio/magnetometer/mmc35240.c | 4 +-- 6 files changed, 32 insertions(+), 25 deletions(-)
Signature · 1 line
2.26.0
[email protected]
maintainerPATCH 1/6 iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
From: Jonathan Cameron <[email protected]>
regmap_bulk_read takes a void * for its val parameter. It certainly makes no sense to cast to a (u8 *) + no need to explicitly cast at all when converting another pointer type to void *.
--- drivers/iio/accel/mxc4005.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/mxc4005.c +2 -2
@@ -135,7 +135,7 @@ static int mxc4005_read_xyz(struct mxc4005_data *data)int ret; ret =regmap_bulk_read (data->regmap,MXC4005_REG_XOUT_UPPER , - (u8 *) data->buffer,sizeof (data->buffer)); + data->buffer,sizeof (data->buffer));if (ret <0 ) {dev_err (data->dev,"failed to read axes\n" );return ret;
@@ -150,7 +150,7 @@ static int mxc4005_read_axis(struct mxc4005_data *data,__be16 reg;int ret; - ret =regmap_bulk_read (data->regmap, addr, (u8 *) ®,sizeof (reg)); + ret =regmap_bulk_read (data->regmap, addr, ®,sizeof (reg));if (ret <0 ) {dev_err (data->dev,"failed to read reg %02x\n" , addr);return ret;
Signature · 1 line
2.26.0
Re: [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
Quoted 6 lines · On Sun, 2020-04-05 at 19:03 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
regmap_bulk_readtakes a void * for its val parameter. It certainly makes no sense to cast to a (u8 *) + no need to explicitly cast at all when converting another pointer type to void *.
Quoted 27 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/accel/mxc4005.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/accel/mxc4005.c +2
-2@@ -135,7 +135,7 @@ static int mxc4005_read_xyz(struct mxc4005_data *data)int ret; ret =regmap_bulk_read (data->regmap,MXC4005_REG_XOUT_UPPER , - (u8 *) data->buffer,sizeof (data->buffer)); + data->buffer,sizeof (data->buffer));if (ret <0 ) {dev_err (data->dev,"failed to read axes\n" );return ret;@@ -150,7 +150,7 @@ static int mxc4005_read_axis(struct mxc4005_data *data,__be16 reg;int ret; - ret =regmap_bulk_read (data->regmap, addr, (u8 *) ®,sizeof (reg)); + ret =regmap_bulk_read (data->regmap, addr, ®,sizeof (reg));if (ret <0 ) {dev_err (data->dev,"failed to read reg %02x\n" , addr);return ret;
[email protected]
maintainerPATCH 2/6 iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
In reply to [email protected]From: Jonathan Cameron <[email protected]>
regmap_bulk_read takes a void * for its val parameter. It certainly makes no sense to cast to a (u8 *) + no need to explicitly cast at all when converting another pointer type to void *.
--- drivers/iio/chemical/atlas-sensor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/chemical/atlas-sensor.c +3 -4
@@ -426,8 +426,7 @@ static irqreturn_t atlas_trigger_handler(int irq, void *private)int ret; ret =regmap_bulk_read (data->regmap, data->chip->data_reg, - (u8 *) &data->buffer, -sizeof (__be32) * channels); + &data->buffer,sizeof (__be32) * channels);if (!ret) iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
@@ -463,7 +462,7 @@ static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val)if (suspended)msleep (data->chip->delay); - ret =regmap_bulk_read (data->regmap, reg, (u8 *) val,sizeof (*val)); + ret =regmap_bulk_read (data->regmap, reg, val,sizeof (*val));pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev);
@@ -485,7 +484,7 @@ static int atlas_read_raw(struct iio_dev *indio_dev,switch (chan->type) {case IIO_TEMP : ret =regmap_bulk_read (data->regmap, chan->address, - (u8 *) ®,sizeof (reg)); + ®,sizeof (reg));break ;case IIO_PH :case IIO_CONCENTRATION :
Signature · 1 line
2.26.0
Re: [PATCH 2/6] iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
Quoted 7 lines · On Sun, Apr 5, 2020 at 11:05 AM <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
regmap_bulk_readtakes a void * for its val parameter. It certainly makes no sense to cast to a (u8 *) + no need to explicitly cast at all when converting another pointer type to void *.
Quoted 41 lines
Signed-off-by Jonathan Cameron <[email protected]>Cc Matt Ranostay <[email protected]>--- drivers/iio/chemical/atlas-sensor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/iio/chemical/atlas-sensor.c +3
-5@@ -426,8 +426,7 @@ static irqreturn_t atlas_trigger_handler(int irq, void *private)int ret; ret =regmap_bulk_read (data->regmap, data->chip->data_reg, - (u8 *) &data->buffer, -sizeof (__be32) * channels); + &data->buffer,sizeof (__be32) * channels);if (!ret) iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,@@ -463,7 +462,7 @@ static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val)if (suspended)msleep (data->chip->delay); - ret =regmap_bulk_read (data->regmap, reg, (u8 *) val,sizeof (*val)); + ret =regmap_bulk_read (data->regmap, reg, val,sizeof (*val));pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev);@@ -485,7 +484,7 @@ static int atlas_read_raw(struct iio_dev *indio_dev,switch (chan->type) {case IIO_TEMP : ret =regmap_bulk_read (data->regmap, chan->address, - (u8 *) ®,sizeof (reg)); + ®,sizeof (reg));break ;case IIO_PH :case IIO_CONCENTRATION : --2.26.0
[email protected]
maintainerPATCH 3/6 iio:chemical:bme680: Tidy up parameters to regmap_bulk_read
In reply to [email protected]From: Jonathan Cameron <[email protected]>
A mixture of:
* Unnecessary casts of val parameter to u8 * which makes little sense as the function take a void *.
* Explicit sizes where we can use the destination type to define that. Note that's not true in all cases as we do read 3 bytes into 4 byte destinations.
Note that noting was broken here, I'm just trying to ensure this doesn't get cut and paste into more drivers so cleaning these out subsystem wide.
--- drivers/iio/chemical/bme680_core.c | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-)
drivers/iio/chemical/bme680_core.c +22 -14
@@ -114,14 +114,16 @@ static int bme680_read_calib(struct bme680_data *data,__le16 buf;/* Temperature related coefficients */ - ret =regmap_bulk_read (data->regmap,BME680_T1_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_T1_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_T1_LSB_REG\n" );return ret; } calib->par_t1 =le16_to_cpu (buf); - ret =regmap_bulk_read (data->regmap,BME680_T2_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_T2_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_T2_LSB_REG\n" );return ret;
@@ -136,14 +138,16 @@ static int bme680_read_calib(struct bme680_data *data, calib->par_t3 = tmp;/* Pressure related coefficients */ - ret =regmap_bulk_read (data->regmap,BME680_P1_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_P1_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_P1_LSB_REG\n" );return ret; } calib->par_p1 =le16_to_cpu (buf); - ret =regmap_bulk_read (data->regmap,BME680_P2_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_P2_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_P2_LSB_REG\n" );return ret;
@@ -157,14 +161,16 @@ static int bme680_read_calib(struct bme680_data *data, } calib->par_p3 = tmp; - ret =regmap_bulk_read (data->regmap,BME680_P4_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_P4_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_P4_LSB_REG\n" );return ret; } calib->par_p4 =le16_to_cpu (buf); - ret =regmap_bulk_read (data->regmap,BME680_P5_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_P5_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_P5_LSB_REG\n" );return ret;
@@ -185,14 +191,16 @@ static int bme680_read_calib(struct bme680_data *data, } calib->par_p7 = tmp; - ret =regmap_bulk_read (data->regmap,BME680_P8_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_P8_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_P8_LSB_REG\n" );return ret; } calib->par_p8 =le16_to_cpu (buf); - ret =regmap_bulk_read (data->regmap,BME680_P9_LSB_REG , (u8 *) &buf,2 ); + ret =regmap_bulk_read (data->regmap,BME680_P9_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_P9_LSB_REG\n" );return ret;
@@ -276,8 +284,8 @@ static int bme680_read_calib(struct bme680_data *data, } calib->par_gh1 = tmp; - ret =regmap_bulk_read (data->regmap,BME680_GH2_LSB_REG , (u8 *) &buf, -2 ); + ret =regmap_bulk_read (data->regmap,BME680_GH2_LSB_REG , + &buf,sizeof (buf));if (ret <0 ) {dev_err (dev,"failed to read BME680_GH2_LSB_REG\n" );return ret;
@@ -615,7 +623,7 @@ static int bme680_read_temp(struct bme680_data *data, int *val)return ret; ret =regmap_bulk_read (data->regmap,BME680_REG_TEMP_MSB , - (u8 *) &tmp,3 ); + &tmp,3 );if (ret <0 ) {dev_err (dev,"failed to read temperature\n" );return ret;
@@ -656,7 +664,7 @@ static int bme680_read_press(struct bme680_data *data,return ret; ret =regmap_bulk_read (data->regmap,BME680_REG_PRESS_MSB , - (u8 *) &tmp,3 ); + &tmp,3 );if (ret <0 ) {dev_err (dev,"failed to read pressure\n" );return ret;
@@ -689,7 +697,7 @@ static int bme680_read_humid(struct bme680_data *data,return ret; ret =regmap_bulk_read (data->regmap,BM6880_REG_HUMIDITY_MSB , - (u8 *) &tmp,2 ); + &tmp,sizeof (tmp));if (ret <0 ) {dev_err (dev,"failed to read humidity\n" );return ret;
@@ -754,7 +762,7 @@ static int bme680_read_gas(struct bme680_data *data, } ret =regmap_bulk_read (data->regmap,BME680_REG_GAS_MSB , - (u8 *) &tmp,2 ); + &tmp,sizeof (tmp));if (ret <0 ) {dev_err (dev,"failed to read gas resistance\n" );return ret;
Signature · 1 line
2.26.0
Re: [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read
Quoted 9 lines · On Sun, Apr 05, 2020 at 07:03:18PM +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
A mixture of:
* Unnecessary casts of val parameter to u8 * which makes little sense as the function take a void *.
* Explicit sizes where we can use the destination type to define that. Note that's not true in all cases as we do read 3 bytes into 4 byte destinations.
Quoted 5 lines
Note that noting was broken here, I'm just trying to ensure this doesn't get cut and paste into more drivers so cleaning these out subsystem wide.
Signed-off-by Jonathan Cameron <[email protected]>CC Himanshu Jha <[email protected]>
drivers/iio/chemical/bme680_core.c static int bme680_read_calib(struct bme680_data *data, · line 117
Quoted 13 lines
--- drivers/iio/chemical/bme680_core.c | 36 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-)drivers/iio/chemical/bme680_core.c +0
-1@@ -114,14 +114,16 @@ static int bme680_read_calib(struct bme680_data *data,__le16 buf;/* Temperature related coefficients */ - ret =regmap_bulk_read (data->regmap,BME680_T1_LSB_REG , (u8 *) &buf,2 );
This was exactly 80 chars ;-)
drivers/iio/chemical/bme680_core.c static int bme680_read_calib(struct bme680_data *data, · line 118
Quoted 2 lines
drivers/iio/chemical/bme680_core.c +2
-0+ ret =regmap_bulk_read (data->regmap,BME680_T1_LSB_REG , + &buf,sizeof (buf));
FYI all complex maths + calib reg addr is now available in the latest datasheet.
Thank You!
Signature · 1 line
Himanshu Jha
[email protected]
maintainerPATCH 4/6 iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
In reply to [email protected]From: Jonathan Cameron <[email protected]>
A mixture of:
* Casts to u8 * for the val parameter which is void * and so needs no cast.
* Explicit sizes when we can use sizeof on the destination / source variable.
Not broken in anyway, I'm just trying to tidy up the is in the subsystem to avoid it getting cut and paste into new drivers.
--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2 -2
@@ -526,7 +526,7 @@ static int inv_mpu6050_sensor_set(struct inv_mpu6050_state *st, int reg,__be16 d =cpu_to_be16 (val); ind = (axis -IIO_MOD_X ) *2 ; - result =regmap_bulk_write (st->map, reg + ind, (u8 *)&d,2 ); + result =regmap_bulk_write (st->map, reg + ind, &d,sizeof (d));if (result)return -EINVAL ;
@@ -540,7 +540,7 @@ static int inv_mpu6050_sensor_show(struct inv_mpu6050_state *st, int reg,__be16 d; ind = (axis -IIO_MOD_X ) *2 ; - result =regmap_bulk_read (st->map, reg + ind, (u8 *)&d,2 ); + result =regmap_bulk_read (st->map, reg + ind, &d,sizeof (d));if (result)return -EINVAL ; *val = (short )be16_to_cpup (&d);
Signature · 1 line
2.26.0
Re: [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
Quoted 9 lines · On Sun, 2020-04-05 at 19:03 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
A mixture of:
* Casts to u8 * for the val parameter which is void * and so needs no cast.
* Explicit sizes when we can use sizeof on the destination / source variable.Not broken in anyway, I'm just trying to tidy up the is in the subsystem to avoid it getting cut and paste into new drivers.
Quoted 31 lines
Signed-off-by Jonathan Cameron <[email protected]>Cc Jean-Baptiste Maneyrol <[email protected]>--- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2
-2@@ -526,7 +526,7 @@ static int inv_mpu6050_sensor_set(struct inv_mpu6050_state *st, int reg, __be16 d = cpu_to_be16(val); ind = (axis -IIO_MOD_X ) *2 ; - result =regmap_bulk_write (st->map, reg + ind, (u8 *)&d,2 ); + result =regmap_bulk_write (st->map, reg + ind, &d,sizeof (d));if (result)return -EINVAL ;@@ -540,7 +540,7 @@ static int inv_mpu6050_sensor_show(struct inv_mpu6050_state *st, int reg, __be16 d; ind = (axis -IIO_MOD_X ) *2 ; - result =regmap_bulk_read (st->map, reg + ind, (u8 *)&d,2 ); + result =regmap_bulk_read (st->map, reg + ind, &d,sizeof (d));if (result)return -EINVAL ;*val = (short)be16_to_cpup(&d);
[email protected]
maintainerPATCH 5/6 iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
In reply to [email protected]From: Jonathan Cameron <[email protected]>
Given the parameter is void *, casting to u8 * is unnecessary.
--- drivers/iio/magnetometer/mmc35240.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/magnetometer/mmc35240.c +2 -2
@@ -239,7 +239,7 @@ static int mmc35240_init(struct mmc35240_data *data)return ret; ret =regmap_bulk_read (data->regmap,MMC35240_OTP_START_ADDR , - (u8 *)otp_data,sizeof (otp_data)); + otp_data,sizeof (otp_data));if (ret <0 )return ret;
@@ -295,7 +295,7 @@ static int mmc35240_read_measurement(struct mmc35240_data *data, __le16 buf[3])if (ret <0 )return ret; -return regmap_bulk_read (data->regmap,MMC35240_REG_XOUT_L , (u8 *)buf, +return regmap_bulk_read (data->regmap,MMC35240_REG_XOUT_L , buf,3 *sizeof (__le16)); }
Signature · 1 line
2.26.0
Re: [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
Quoted 4 lines · On Sun, 2020-04-05 at 19:03 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Given the parameter is void *, casting to u8 * is unnecessary.
Quoted 30 lines
Signed-off-by Jonathan Cameron <[email protected]>Cc Daniel Baluta <[email protected]>--- drivers/iio/magnetometer/mmc35240.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/magnetometer/mmc35240.c +2
-2@@ -239,7 +239,7 @@ static int mmc35240_init(struct mmc35240_data *data)return ret; ret =regmap_bulk_read (data->regmap,MMC35240_OTP_START_ADDR , - (u8 *)otp_data,sizeof (otp_data)); + otp_data,sizeof (otp_data));if (ret <0 )return ret;@@ -295,7 +295,7 @@ static int mmc35240_read_measurement(struct mmc35240_data *data, __le16 buf[3])if (ret <0 )return ret; -return regmap_bulk_read (data->regmap,MMC35240_REG_XOUT_L , (u8 *)buf, +return regmap_bulk_read (data->regmap,MMC35240_REG_XOUT_L , buf,3 *sizeof (__le16)); }
[email protected]
maintainerPATCH 6/6 iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read
In reply to [email protected]From: Jonathan Cameron <[email protected]>
This only occurs once in the driver and isn't needed in this case either, so drop it.
--- drivers/iio/light/ltr501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/ltr501.c +1 -1
@@ -1263,7 +1263,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)if (mask <R501_STATUS_ALS_RDY ) { ret =regmap_bulk_read (data->regmap,LTR501_ALS_DATA1 , - (u8 *)als_buf,sizeof (als_buf)); + als_buf,sizeof (als_buf));if (ret <0 )return ret;if (test_bit (0 , indio_dev->active_scan_mask))
Signature · 1 line
2.26.0
Re: [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read
Quoted 5 lines · On Sun, 2020-04-05 at 19:03 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
This only occurs once in the driver and isn't needed in this case either, so drop it.
Quoted 19 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/ltr501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/ltr501.c +1
-1@@ -1263,7 +1263,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)if (mask <R501_STATUS_ALS_RDY ) { ret =regmap_bulk_read (data->regmap,LTR501_ALS_DATA1 , - (u8 *)als_buf,sizeof (als_buf)); + als_buf,sizeof (als_buf));if (ret <0 )return ret;if (
test_bit(0, indio_dev->active_scan_mask))
If anyone is bored and fancies sanity checking the ones in this series that have had no eyes on them yet, it would be much appreciated!
Thanks,
Jonathan
Quoted 39 lines · On Sun, 5 Apr 2020 19:03:15 +0100 [email protected] wrote:
From: Jonathan Cameron <[email protected]>
One of Andy Shevchenko's recent patches tidied a case of this up and a quick grep showed we had some more.
The main focus of this set is calls to
regmap_bulk_read/regmap_bulk_write. Both are used with buffers of many and varied type, but as they take a void * there is never any need to cast a pointer to said buffers to anything explicitly.Whilst I was here I used sizeof(buf) in various places to reduce the use of explicit values when we could derive it from the source / destination buffer.
This isn't remotely urgent, but I'd like to clean these out to avoid replication in future. Not I didn't go after any other unnecessary casts in the files because that would have take thought and its Sunday evening and about time for a beer.
Jonathan Cameron (6):
iio:accel:mxc4005: Drop unnecessary explicit casts inregmap_bulk_read
calls
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in
regmap_bulk_readcalls
iio:chemical:bme680: Tidy up parameters toregmap_bulk_readiio:imu:mpu6050: Tidy up parameters toregmap_bulkfunctions. iio:magn:mmc35240: Drop unnecessary casts of val parameter in
regmap_bulk*
iio:light:ltr501: Drop unnecessary cast of parameter in
regmap_bulk_readdrivers/iio/accel/mxc4005.c | 4 +-- drivers/iio/chemical/atlas-sensor.c | 7 ++--- drivers/iio/chemical/bme680_core.c | 36 +++++++++++++--------- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 +-- drivers/iio/light/ltr501.c | 2 +- drivers/iio/magnetometer/mmc35240.c | 4 +-- 6 files changed, 32 insertions(+), 25 deletions(-)
Quoted 3 lines · Jonathan Cameron
If anyone is bored and fancies sanity checking the ones in this series that have had no eyes on them yet, it would be much appreciated!
The series makes sense to me. Feel free to add my Rb tag to it if you like.
Quoted 43 lines
Quoted 39 lines · On Sun, 5 Apr 2020 19:03:15 +0100 [email protected] wrote:
From: Jonathan Cameron <[email protected]>
One of Andy Shevchenko's recent patches tidied a case of this up and a quick grep showed we had some more.
The main focus of this set is calls to
regmap_bulk_read/regmap_bulk_write. Both are used with buffers of many and varied type, but as they take a void * there is never any need to cast a pointer to said buffers to anything explicitly.Whilst I was here I used sizeof(buf) in various places to reduce the use of explicit values when we could derive it from the source / destination buffer.
This isn't remotely urgent, but I'd like to clean these out to avoid replication in future. Not I didn't go after any other unnecessary casts in the files because that would have take thought and its Sunday evening and about time for a beer.
Jonathan Cameron (6):
iio:accel:mxc4005: Drop unnecessary explicit casts inregmap_bulk_read
calls
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in
regmap_bulk_readcalls
iio:chemical:bme680: Tidy up parameters toregmap_bulk_readiio:imu:mpu6050: Tidy up parameters toregmap_bulkfunctions. iio:magn:mmc35240: Drop unnecessary casts of val parameter in
regmap_bulk*
iio:light:ltr501: Drop unnecessary cast of parameter in
regmap_bulk_readdrivers/iio/accel/mxc4005.c | 4 +-- drivers/iio/chemical/atlas-sensor.c | 7 ++--- drivers/iio/chemical/bme680_core.c | 36 +++++++++++++--------- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 +-- drivers/iio/light/ltr501.c | 2 +- drivers/iio/magnetometer/mmc35240.c | 4 +-- 6 files changed, 32 insertions(+), 25 deletions(-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · Andy Shevchenko
Quoted 2 lines · Jonathan Cameron
If anyone is bored and fancies sanity checking the ones in this series that have had no eyes on them yet, it would be much appreciated!
The series makes sense to me. Feel free to add my Rb tag to it if you like.
Same from my side.
I added my tag on the patches.
I waited a bit until some driver authors replied back.
Quoted 44 lines
Quoted 42 lines
Quoted 39 lines · On Sun, 5 Apr 2020 19:03:15 +0100 [email protected] wrote:
From: Jonathan Cameron <[email protected]>
One of Andy Shevchenko's recent patches tidied a case of this up and a quick grep showed we had some more.
The main focus of this set is calls to
regmap_bulk_read/regmap_bulk_write. Both are used with buffers of many and varied type, but as they take a void * there is never any need to cast a pointer to said buffers to anything explicitly.Whilst I was here I used sizeof(buf) in various places to reduce the use of explicit values when we could derive it from the source / destination buffer.
This isn't remotely urgent, but I'd like to clean these out to avoid replication in future. Not I didn't go after any other unnecessary casts in the files because that would have take thought and its Sunday evening and about time for a beer.
Jonathan Cameron (6):
iio:accel:mxc4005: Drop unnecessary explicit casts inregmap_bulk_read
calls
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in
regmap_bulk_readcalls
iio:chemical:bme680: Tidy up parameters toregmap_bulk_readiio:imu:mpu6050: Tidy up parameters toregmap_bulkfunctions. iio:magn:mmc35240: Drop unnecessary casts of val parameter in
regmap_bulk*
iio:light:ltr501: Drop unnecessary cast of parameter in
regmap_bulk_readdrivers/iio/accel/mxc4005.c | 4 +-- drivers/iio/chemical/atlas-sensor.c | 7 ++--- drivers/iio/chemical/bme680_core.c | 36 +++++++++++++--------- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 +-- drivers/iio/light/ltr501.c | 2 +- drivers/iio/magnetometer/mmc35240.c | 4 +-- 6 files changed, 32 insertions(+), 25 deletions(-)
Jonathan Cameron
maintainerQuoted 6 lines · Alexandru
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Jonathan Cameron
If anyone is bored and fancies sanity checking the ones in this series that have had no eyes on them yet, it would be much appreciated!
Quoted 6 lines
Quoted 2 lines
The series makes sense to me. Feel free to add my Rb tag to it if you like.
Same from my side.
I added my tag on the patches.
I waited a bit until some driver authors replied back.
Thanks to both of you!
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 46 lines
Quoted 46 lines
Quoted 44 lines
Quoted 39 lines · On Sun, 5 Apr 2020 19:03:15 +0100 [email protected] wrote:
From: Jonathan Cameron <[email protected]>
One of Andy Shevchenko's recent patches tidied a case of this up and a quick grep showed we had some more.
The main focus of this set is calls to
regmap_bulk_read/regmap_bulk_write. Both are used with buffers of many and varied type, but as they take a void * there is never any need to cast a pointer to said buffers to anything explicitly.Whilst I was here I used sizeof(buf) in various places to reduce the use of explicit values when we could derive it from the source / destination buffer.
This isn't remotely urgent, but I'd like to clean these out to avoid replication in future. Not I didn't go after any other unnecessary casts in the files because that would have take thought and its Sunday evening and about time for a beer.
Jonathan Cameron (6):
iio:accel:mxc4005: Drop unnecessary explicit casts inregmap_bulk_read
calls
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in
regmap_bulk_readcalls
iio:chemical:bme680: Tidy up parameters toregmap_bulk_readiio:imu:mpu6050: Tidy up parameters toregmap_bulkfunctions. iio:magn:mmc35240: Drop unnecessary casts of val parameter in
regmap_bulk*
iio:light:ltr501: Drop unnecessary cast of parameter in
regmap_bulk_readdrivers/iio/accel/mxc4005.c | 4 +-- drivers/iio/chemical/atlas-sensor.c | 7 ++--- drivers/iio/chemical/bme680_core.c | 36 +++++++++++++--------- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 +-- drivers/iio/light/ltr501.c | 2 +- drivers/iio/magnetometer/mmc35240.c | 4 +-- 6 files changed, 32 insertions(+), 25 deletions(-)