iio: chemical: bme680: use BME680_NUM_CHANNELS
v2 cover iio: chemical: bme680: use BME680_NUM_CHANNELS
Hi,
This patch updates the BME680 driver to use the existing BME680_NUM_CHANNELS macro instead of a hardcoded value in the scan buffer.
In the previous version, the macro was proposed for removal as it appeared unused. However, it was pointed out during review that it is intended to represent the number of channels in the scan buffer.
This version addresses that feedback by using the macro instead of removing it, improving readability and maintainability.
Changes in v2:
Use BME680_NUM_CHANNELS instead of hardcoded value Keep the macro instead of removing it Address review feedback from Jonathan Cameron
Thanks,
Nikhil Gautam
Nikhil Gautam (1):
iio: chemical: bme680: use BME680_NUM_CHANNELS for scan buffer
drivers/iio/chemical/bme680_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.34.1
PATCH v2 1/1 iio: chemical: bme680: use BME680_NUM_CHANNELS for scan buffer
Use BME680_NUM_CHANNELS instead of the hardcoded channel count in the scan buffer.
This avoids use of a magic number and improves code readability and maintainability.
--- drivers/iio/chemical/bme680_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/bme680_core.c +1 -1
@@ -128,7 +128,7 @@ struct bme680_data {u16 heater_temp;struct { -s32 chan[4 ]; +s32 chan[BME680_NUM_CHANNELS ];aligned_s64 ts; } scan;
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerRe: [PATCH v2 1/1] iio: chemical: bme680: use BME680_NUM_CHANNELS for scan buffer
Quoted 8 lines · On Mon, 20 Apr 2026 13:54:36 +0530 Nikhil Gautam <[email protected]> wrote:
Use
BME680_NUM_CHANNELSinstead of the hardcoded channel count in the scan buffer.This avoids use of a magic number and improves code readability and maintainability.
Suggested-by Jonathan Cameron <[email protected]>Signed-off-by Nikhil Gautam <[email protected]>
I think I sat on this to see if anyone else wanted to review then lost it (patchwork kept track though!)
Anyhow, applied to the testing branch of iio.git.
Thanks,
Jonathan
Quoted 17 lines
--- drivers/iio/chemical/bme680_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/chemical/bme680_core.c +1
-1@@ -128,7 +128,7 @@ struct bme680_data {u16 heater_temp;struct { -s32 chan[4 ]; +s32 chan[BME680_NUM_CHANNELS ];aligned_s64 ts; } scan;