diff mbox series

[4/6] iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.

Message ID 20200405180321.1737310-5-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series IIO: Tidy up parameters to regmap_bulk_* calls | expand

Commit Message

Jonathan Cameron April 5, 2020, 6:03 p.m. UTC
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(-)

Comments

Alexandru Ardelean April 13, 2020, 4:32 a.m. UTC | #1
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);
diff mbox series

Patch

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