Re: [PATCH 3/6] iio:chemical:bme680: Tidy up parameters to regmap_bulk_read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 05, 2020 at 07:03:18PM +0100, jic23@xxxxxxxxxx wrote:
> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> CC: Himanshu Jha <himanshujha199640@xxxxxxxxx>

Acked-by: Himanshu Jha <himanshujha199640@xxxxxxxxx>

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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux