* [PATCH 1/2] iio: adc: rohm-bd79112: Use regmap_reg_range()
2025-10-27 12:50 [PATCH 0/2] iio: accel: rohm: use regmap_reg_range() Matti Vaittinen
@ 2025-10-27 12:50 ` Matti Vaittinen
2025-10-27 12:50 ` [PATCH 2/2] iio: adc: rohm-bd79124: " Matti Vaittinen
2025-10-27 14:54 ` [PATCH 0/2] iio: accel: rohm: use regmap_reg_range() Jonathan Cameron
2 siblings, 0 replies; 4+ messages in thread
From: Matti Vaittinen @ 2025-10-27 12:50 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Matti Vaittinen, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]
Initializing the regmap_ranges using direct assignment to the range_min
and range_max members is slightly verbose. We can make it a tad cleaner
when using the regmap_reg_range() macro.
Clean up the code using regmap_reg_range() when initializing the
regmap_range structure.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
Compile tested only.
---
drivers/iio/adc/rohm-bd79112.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/adc/rohm-bd79112.c b/drivers/iio/adc/rohm-bd79112.c
index d15e06c8b94d..7420aa6627d5 100644
--- a/drivers/iio/adc/rohm-bd79112.c
+++ b/drivers/iio/adc/rohm-bd79112.c
@@ -168,15 +168,10 @@ static int _get_gpio_reg(unsigned int offset, unsigned int base)
#define GET_GPI_VAL_REG(offset) _get_gpio_reg((offset), BD79112_REG_GPI_VALUE_A0_A7)
static const struct regmap_range bd71815_volatile_ro_ranges[] = {
- {
- /* Read ADC data */
- .range_min = BD79112_REG_AGIO0A,
- .range_max = BD79112_REG_AGIO15B,
- }, {
- /* GPI state */
- .range_min = BD79112_REG_GPI_VALUE_B8_15,
- .range_max = BD79112_REG_GPI_VALUE_A0_A7,
- },
+ /* Read ADC data */
+ regmap_reg_range(BD79112_REG_AGIO0A, BD79112_REG_AGIO15B),
+ /* GPI state */
+ regmap_reg_range(BD79112_REG_GPI_VALUE_B8_15, BD79112_REG_GPI_VALUE_A0_A7),
};
static const struct regmap_access_table bd79112_volatile_regs = {
--
2.51.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] iio: adc: rohm-bd79124: Use regmap_reg_range()
2025-10-27 12:50 [PATCH 0/2] iio: accel: rohm: use regmap_reg_range() Matti Vaittinen
2025-10-27 12:50 ` [PATCH 1/2] iio: adc: rohm-bd79112: Use regmap_reg_range() Matti Vaittinen
@ 2025-10-27 12:50 ` Matti Vaittinen
2025-10-27 14:54 ` [PATCH 0/2] iio: accel: rohm: use regmap_reg_range() Jonathan Cameron
2 siblings, 0 replies; 4+ messages in thread
From: Matti Vaittinen @ 2025-10-27 12:50 UTC (permalink / raw)
To: Matti Vaittinen, Matti Vaittinen
Cc: Matti Vaittinen, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2892 bytes --]
Initializing the regmap_ranges using direct assignment to the range_min
and range_max members is slightly verbose. We can make it a tad cleaner
when using the regmap_reg_range() macro.
Clean up the code using regmap_reg_range() when initializing the
regmap_range structure.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
Compile tested only.
---
drivers/iio/adc/rohm-bd79124.c | 39 ++++++++--------------------------
1 file changed, 9 insertions(+), 30 deletions(-)
diff --git a/drivers/iio/adc/rohm-bd79124.c b/drivers/iio/adc/rohm-bd79124.c
index 06c55c8da93f..fc0452749b79 100644
--- a/drivers/iio/adc/rohm-bd79124.c
+++ b/drivers/iio/adc/rohm-bd79124.c
@@ -126,13 +126,8 @@ struct bd79124_data {
};
static const struct regmap_range bd79124_ro_ranges[] = {
- {
- .range_min = BD79124_REG_EVENT_FLAG,
- .range_max = BD79124_REG_EVENT_FLAG,
- }, {
- .range_min = BD79124_REG_RECENT_CH0_LSB,
- .range_max = BD79124_REG_RECENT_CH7_MSB,
- },
+ regmap_reg_range(BD79124_REG_EVENT_FLAG, BD79124_REG_EVENT_FLAG),
+ regmap_reg_range(BD79124_REG_RECENT_CH0_LSB, BD79124_REG_RECENT_CH7_MSB),
};
static const struct regmap_access_table bd79124_ro_regs = {
@@ -141,22 +136,11 @@ static const struct regmap_access_table bd79124_ro_regs = {
};
static const struct regmap_range bd79124_volatile_ranges[] = {
- {
- .range_min = BD79124_REG_RECENT_CH0_LSB,
- .range_max = BD79124_REG_RECENT_CH7_MSB,
- }, {
- .range_min = BD79124_REG_EVENT_FLAG,
- .range_max = BD79124_REG_EVENT_FLAG,
- }, {
- .range_min = BD79124_REG_EVENT_FLAG_HI,
- .range_max = BD79124_REG_EVENT_FLAG_HI,
- }, {
- .range_min = BD79124_REG_EVENT_FLAG_LO,
- .range_max = BD79124_REG_EVENT_FLAG_LO,
- }, {
- .range_min = BD79124_REG_SYSTEM_STATUS,
- .range_max = BD79124_REG_SYSTEM_STATUS,
- },
+ regmap_reg_range(BD79124_REG_RECENT_CH0_LSB, BD79124_REG_RECENT_CH7_MSB),
+ regmap_reg_range(BD79124_REG_EVENT_FLAG, BD79124_REG_EVENT_FLAG),
+ regmap_reg_range(BD79124_REG_EVENT_FLAG_HI, BD79124_REG_EVENT_FLAG_HI),
+ regmap_reg_range(BD79124_REG_EVENT_FLAG_LO, BD79124_REG_EVENT_FLAG_LO),
+ regmap_reg_range(BD79124_REG_SYSTEM_STATUS, BD79124_REG_SYSTEM_STATUS),
};
static const struct regmap_access_table bd79124_volatile_regs = {
@@ -165,13 +149,8 @@ static const struct regmap_access_table bd79124_volatile_regs = {
};
static const struct regmap_range bd79124_precious_ranges[] = {
- {
- .range_min = BD79124_REG_EVENT_FLAG_HI,
- .range_max = BD79124_REG_EVENT_FLAG_HI,
- }, {
- .range_min = BD79124_REG_EVENT_FLAG_LO,
- .range_max = BD79124_REG_EVENT_FLAG_LO,
- },
+ regmap_reg_range(BD79124_REG_EVENT_FLAG_HI, BD79124_REG_EVENT_FLAG_HI),
+ regmap_reg_range(BD79124_REG_EVENT_FLAG_LO, BD79124_REG_EVENT_FLAG_LO),
};
static const struct regmap_access_table bd79124_precious_regs = {
--
2.51.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread