All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls
@ 2020-04-05 18:03 jic23
  2020-04-05 18:03 ` [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls jic23
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: jic23 @ 2020-04-05 18:03 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, Jonathan Cameron

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

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(-)

-- 
2.26.0


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

* [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
  2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
@ 2020-04-05 18:03 ` jic23
  2020-04-13  4:31   ` Ardelean, Alexandru
  2020-04-05 18:03 ` [PATCH 2/6] iio:chemical:atlas-sensor: " jic23
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: jic23 @ 2020-04-05 18:03 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, Jonathan Cameron

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

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 *.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/mxc4005.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
index 3d5bea651923..9d07642c0de1 100644
--- a/drivers/iio/accel/mxc4005.c
+++ b/drivers/iio/accel/mxc4005.c
@@ -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 *) &reg, sizeof(reg));
+	ret = regmap_bulk_read(data->regmap, addr, &reg, sizeof(reg));
 	if (ret < 0) {
 		dev_err(data->dev, "failed to read reg %02x\n", addr);
 		return ret;
-- 
2.26.0


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

* [PATCH 2/6] iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
  2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
  2020-04-05 18:03 ` [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls jic23
@ 2020-04-05 18:03 ` jic23
  2020-04-06  0:54   ` Matt Ranostay
  2020-04-05 18:03 ` [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read jic23
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: jic23 @ 2020-04-05 18:03 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, Jonathan Cameron, Matt Ranostay

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

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 *.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/iio/chemical/atlas-sensor.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
index 82d470561ad3..973cdb4f1e83 100644
--- a/drivers/iio/chemical/atlas-sensor.c
+++ b/drivers/iio/chemical/atlas-sensor.c
@@ -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 *) &reg, sizeof(reg));
+					       &reg, sizeof(reg));
 			break;
 		case IIO_PH:
 		case IIO_CONCENTRATION:
-- 
2.26.0


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

* [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read
  2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
  2020-04-05 18:03 ` [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls jic23
  2020-04-05 18:03 ` [PATCH 2/6] iio:chemical:atlas-sensor: " jic23
@ 2020-04-05 18:03 ` jic23
  2020-04-06 13:08   ` Himanshu Jha
  2020-04-05 18:03 ` [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions jic23
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: jic23 @ 2020-04-05 18:03 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, Jonathan Cameron, Himanshu Jha

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

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
CC: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/iio/chemical/bme680_core.c | 36 ++++++++++++++++++------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
index ccde4c65ff93..13773e01699b 100644
--- a/drivers/iio/chemical/bme680_core.c
+++ b/drivers/iio/chemical/bme680_core.c
@@ -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;
-- 
2.26.0


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

* [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
  2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
                   ` (2 preceding siblings ...)
  2020-04-05 18:03 ` [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read jic23
@ 2020-04-05 18:03 ` jic23
  2020-04-13  4:32   ` Ardelean, Alexandru
  2020-04-05 18:03 ` [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk* jic23
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: jic23 @ 2020-04-05 18:03 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, Jonathan Cameron, Jean-Baptiste Maneyrol

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

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index e4b0d368c2f9..d3819b516ec6 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -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);
-- 
2.26.0


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

* [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
  2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
                   ` (3 preceding siblings ...)
  2020-04-05 18:03 ` [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions jic23
@ 2020-04-05 18:03 ` jic23
  2020-04-13  4:32   ` Ardelean, Alexandru
  2020-04-05 18:03 ` [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read jic23
  2020-04-12 13:48 ` [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls Jonathan Cameron
  6 siblings, 1 reply; 17+ messages in thread
From: jic23 @ 2020-04-05 18:03 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, Jonathan Cameron, Daniel Baluta

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

Given the parameter is void *, casting to u8 * is unnecessary.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
---
 drivers/iio/magnetometer/mmc35240.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index 425cdd07b4e5..1787d656d009 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -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));
 }
 
-- 
2.26.0


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

* [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read
  2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
                   ` (4 preceding siblings ...)
  2020-04-05 18:03 ` [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk* jic23
@ 2020-04-05 18:03 ` jic23
  2020-04-13  4:33   ` Ardelean, Alexandru
  2020-04-12 13:48 ` [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls Jonathan Cameron
  6 siblings, 1 reply; 17+ messages in thread
From: jic23 @ 2020-04-05 18:03 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, Jonathan Cameron

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

This only occurs once in the driver and isn't needed in this case either,
so drop it.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 71f99d2a22c1..0626927251bb 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -1263,7 +1263,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
 
 	if (mask & LTR501_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))
-- 
2.26.0


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

* Re: [PATCH 2/6] iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
  2020-04-05 18:03 ` [PATCH 2/6] iio:chemical:atlas-sensor: " jic23
@ 2020-04-06  0:54   ` Matt Ranostay
  0 siblings, 0 replies; 17+ messages in thread
From: Matt Ranostay @ 2020-04-06  0:54 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: open list:IIO SUBSYSTEM AND DRIVERS, Andy Shevchenko, Jonathan Cameron

On Sun, Apr 5, 2020 at 11:05 AM <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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 *.
>

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> ---
>  drivers/iio/chemical/atlas-sensor.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
> index 82d470561ad3..973cdb4f1e83 100644
> --- a/drivers/iio/chemical/atlas-sensor.c
> +++ b/drivers/iio/chemical/atlas-sensor.c
> @@ -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 *) &reg, sizeof(reg));
> +                                              &reg, sizeof(reg));
>                         break;
>                 case IIO_PH:
>                 case IIO_CONCENTRATION:
> --
> 2.26.0
>

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

* Re: [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read
  2020-04-05 18:03 ` [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read jic23
@ 2020-04-06 13:08   ` Himanshu Jha
  0 siblings, 0 replies; 17+ messages in thread
From: Himanshu Jha @ 2020-04-06 13:08 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, Andy Shevchenko, Jonathan Cameron

On Sun, Apr 05, 2020 at 07:03:18PM +0100, jic23@kernel.org wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> CC: Himanshu Jha <himanshujha199640@gmail.com>

Acked-by: Himanshu Jha <himanshujha199640@gmail.com>

> ---
>  drivers/iio/chemical/bme680_core.c | 36 ++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> index ccde4c65ff93..13773e01699b 100644
> --- a/drivers/iio/chemical/bme680_core.c
> +++ b/drivers/iio/chemical/bme680_core.c
> @@ -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 ;-)

> +	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!
-- 
Himanshu Jha

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

* Re: [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls
  2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
                   ` (5 preceding siblings ...)
  2020-04-05 18:03 ` [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read jic23
@ 2020-04-12 13:48 ` Jonathan Cameron
  2020-04-12 20:59   ` Andy Shevchenko
  6 siblings, 1 reply; 17+ messages in thread
From: Jonathan Cameron @ 2020-04-12 13:48 UTC (permalink / raw)
  To: linux-iio; +Cc: Andy Shevchenko, 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!

Thanks,

Jonathan

On Sun,  5 Apr 2020 19:03:15 +0100
jic23@kernel.org wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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(-)
> 


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

* Re: [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls
  2020-04-12 13:48 ` [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls Jonathan Cameron
@ 2020-04-12 20:59   ` Andy Shevchenko
  2020-04-13  4:34     ` Ardelean, Alexandru
  0 siblings, 1 reply; 17+ messages in thread
From: Andy Shevchenko @ 2020-04-12 20:59 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Jonathan Cameron

On Sun, Apr 12, 2020 at 4:48 PM Jonathan Cameron
<jic23@jic23.retrosnub.co.uk> wrote:
>
> 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.

> On Sun,  5 Apr 2020 19:03:15 +0100
> jic23@kernel.org wrote:
>
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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(-)
> >
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
  2020-04-05 18:03 ` [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls jic23
@ 2020-04-13  4:31   ` Ardelean, Alexandru
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Alexandru @ 2020-04-13  4:31 UTC (permalink / raw)
  To: jic23, linux-iio; +Cc: andy.shevchenko, Jonathan.Cameron

On Sun, 2020-04-05 at 19:03 +0100, jic23@kernel.org wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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 *.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/accel/mxc4005.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
> index 3d5bea651923..9d07642c0de1 100644
> --- a/drivers/iio/accel/mxc4005.c
> +++ b/drivers/iio/accel/mxc4005.c
> @@ -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 *) &reg, sizeof(reg));
> +	ret = regmap_bulk_read(data->regmap, addr, &reg, sizeof(reg));
>  	if (ret < 0) {
>  		dev_err(data->dev, "failed to read reg %02x\n", addr);
>  		return ret;

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

* Re: [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
  2020-04-05 18:03 ` [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions jic23
@ 2020-04-13  4:32   ` Ardelean, Alexandru
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Alexandru @ 2020-04-13  4:32 UTC (permalink / raw)
  To: jic23, linux-iio; +Cc: andy.shevchenko, jmaneyrol, Jonathan.Cameron

On Sun, 2020-04-05 at 19:03 +0100, jic23@kernel.org wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index e4b0d368c2f9..d3819b516ec6 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -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);

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

* Re: [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
  2020-04-05 18:03 ` [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk* jic23
@ 2020-04-13  4:32   ` Ardelean, Alexandru
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Alexandru @ 2020-04-13  4:32 UTC (permalink / raw)
  To: jic23, linux-iio; +Cc: andy.shevchenko, Jonathan.Cameron, daniel.baluta

On Sun, 2020-04-05 at 19:03 +0100, jic23@kernel.org wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Given the parameter is void *, casting to u8 * is unnecessary.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Daniel Baluta <daniel.baluta@gmail.com>
> ---
>  drivers/iio/magnetometer/mmc35240.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/magnetometer/mmc35240.c
> b/drivers/iio/magnetometer/mmc35240.c
> index 425cdd07b4e5..1787d656d009 100644
> --- a/drivers/iio/magnetometer/mmc35240.c
> +++ b/drivers/iio/magnetometer/mmc35240.c
> @@ -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));
>  }
>  

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

* Re: [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read
  2020-04-05 18:03 ` [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read jic23
@ 2020-04-13  4:33   ` Ardelean, Alexandru
  0 siblings, 0 replies; 17+ messages in thread
From: Ardelean, Alexandru @ 2020-04-13  4:33 UTC (permalink / raw)
  To: jic23, linux-iio; +Cc: andy.shevchenko, Jonathan.Cameron

On Sun, 2020-04-05 at 19:03 +0100, jic23@kernel.org wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> This only occurs once in the driver and isn't needed in this case either,
> so drop it.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/light/ltr501.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index 71f99d2a22c1..0626927251bb 100644
> --- a/drivers/iio/light/ltr501.c
> +++ b/drivers/iio/light/ltr501.c
> @@ -1263,7 +1263,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void
> *p)
>  
>  	if (mask & LTR501_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))

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

* Re: [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls
  2020-04-12 20:59   ` Andy Shevchenko
@ 2020-04-13  4:34     ` Ardelean, Alexandru
  2020-04-13 15:07       ` Jonathan Cameron
  0 siblings, 1 reply; 17+ messages in thread
From: Ardelean, Alexandru @ 2020-04-13  4:34 UTC (permalink / raw)
  To: andy.shevchenko, jic23; +Cc: Jonathan.Cameron, linux-iio

On Sun, 2020-04-12 at 23:59 +0300, Andy Shevchenko wrote:
> On Sun, Apr 12, 2020 at 4:48 PM Jonathan Cameron
> <jic23@jic23.retrosnub.co.uk> wrote:
> > 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.


> > On Sun,  5 Apr 2020 19:03:15 +0100
> > jic23@kernel.org wrote:
> > 
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > 
> > > 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(-)
> > > 
> 
> 

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

* Re: [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls
  2020-04-13  4:34     ` Ardelean, Alexandru
@ 2020-04-13 15:07       ` Jonathan Cameron
  0 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2020-04-13 15:07 UTC (permalink / raw)
  To: Ardelean, Alexandru; +Cc: andy.shevchenko, Jonathan.Cameron, linux-iio

On Mon, 13 Apr 2020 04:34:50 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Sun, 2020-04-12 at 23:59 +0300, Andy Shevchenko wrote:
> > On Sun, Apr 12, 2020 at 4:48 PM Jonathan Cameron
> > <jic23@jic23.retrosnub.co.uk> wrote:  
> > > 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.
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

> 
> 
> > > On Sun,  5 Apr 2020 19:03:15 +0100
> > > jic23@kernel.org wrote:
> > >   
> > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > > 
> > > > 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(-)
> > > >   
> > 
> >   


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

end of thread, other threads:[~2020-04-13 15:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 18:03 [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls jic23
2020-04-05 18:03 ` [PATCH 1/6] iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls jic23
2020-04-13  4:31   ` Ardelean, Alexandru
2020-04-05 18:03 ` [PATCH 2/6] iio:chemical:atlas-sensor: " jic23
2020-04-06  0:54   ` Matt Ranostay
2020-04-05 18:03 ` [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read jic23
2020-04-06 13:08   ` Himanshu Jha
2020-04-05 18:03 ` [PATCH 4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions jic23
2020-04-13  4:32   ` Ardelean, Alexandru
2020-04-05 18:03 ` [PATCH 5/6] iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk* jic23
2020-04-13  4:32   ` Ardelean, Alexandru
2020-04-05 18:03 ` [PATCH 6/6] iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read jic23
2020-04-13  4:33   ` Ardelean, Alexandru
2020-04-12 13:48 ` [PATCH 0/6] IIO: Tidy up parameters to regmap_bulk_* calls Jonathan Cameron
2020-04-12 20:59   ` Andy Shevchenko
2020-04-13  4:34     ` Ardelean, Alexandru
2020-04-13 15:07       ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.