diff mbox series

[v1,2/3] iio: pressure: bmp280: Use sizeof() for denominator

Message ID 20241202181907.21471-3-vassilisamir@gmail.com (mailing list archive)
State Accepted
Headers show
Series iio: pressure: bmp280: Minor cleanup | expand

Commit Message

Vasileios Amoiridis Dec. 2, 2024, 6:19 p.m. UTC
Instead of using magic number 2 as a denominator, make it intuitive by
using sizeof().

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
---
 drivers/iio/pressure/bmp280.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron Dec. 8, 2024, 6:06 p.m. UTC | #1
On Mon,  2 Dec 2024 19:19:06 +0100
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:

> Instead of using magic number 2 as a denominator, make it intuitive by
> using sizeof().
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Applied this patch.

Thanks,

Jonathan

> ---
>  drivers/iio/pressure/bmp280.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/bmp280.h b/drivers/iio/pressure/bmp280.h
> index 2df1175b6b85..a3631bc0e188 100644
> --- a/drivers/iio/pressure/bmp280.h
> +++ b/drivers/iio/pressure/bmp280.h
> @@ -470,8 +470,8 @@ struct bmp280_data {
>  		/* Sensor data buffer */
>  		u8 buf[BME280_BURST_READ_BYTES];
>  		/* Calibration data buffers */
> -		__le16 bmp280_cal_buf[BMP280_CONTIGUOUS_CALIB_REGS / 2];
> -		__be16 bmp180_cal_buf[BMP180_REG_CALIB_COUNT / 2];
> +		__le16 bmp280_cal_buf[BMP280_CONTIGUOUS_CALIB_REGS / sizeof(__le16)];
> +		__be16 bmp180_cal_buf[BMP180_REG_CALIB_COUNT / sizeof(__be16)];
>  		u8 bme280_humid_cal_buf[BME280_CONTIGUOUS_CALIB_REGS];
>  		u8 bmp380_cal_buf[BMP380_CALIB_REG_COUNT];
>  		/* Miscellaneous, endianness-aware data buffers */
diff mbox series

Patch

diff --git a/drivers/iio/pressure/bmp280.h b/drivers/iio/pressure/bmp280.h
index 2df1175b6b85..a3631bc0e188 100644
--- a/drivers/iio/pressure/bmp280.h
+++ b/drivers/iio/pressure/bmp280.h
@@ -470,8 +470,8 @@  struct bmp280_data {
 		/* Sensor data buffer */
 		u8 buf[BME280_BURST_READ_BYTES];
 		/* Calibration data buffers */
-		__le16 bmp280_cal_buf[BMP280_CONTIGUOUS_CALIB_REGS / 2];
-		__be16 bmp180_cal_buf[BMP180_REG_CALIB_COUNT / 2];
+		__le16 bmp280_cal_buf[BMP280_CONTIGUOUS_CALIB_REGS / sizeof(__le16)];
+		__be16 bmp180_cal_buf[BMP180_REG_CALIB_COUNT / sizeof(__be16)];
 		u8 bme280_humid_cal_buf[BME280_CONTIGUOUS_CALIB_REGS];
 		u8 bmp380_cal_buf[BMP380_CALIB_REG_COUNT];
 		/* Miscellaneous, endianness-aware data buffers */