Skip to contentSkip to conversation

iio: accel: rohm: use regmap_reg_range()

PATCH In review Matti Vaittinen 2 participants 4 messages Oct 27, 2025

Subsystems (2)
lore
Share & tools
lore

Matti Vaittinen

author maintainer
#0 lore raw

cover iio: accel: rohm: use regmap_reg_range()

Use regmap_reg_range() when initializing regmap_range arrays

Clean-up couple of ROHM drivers which assign the reg_ranges directly. This reduces couple of lines of code.

NOTE: Changes are compile-tested only.

---

Matti Vaittinen (2):
iio: adc: rohm-bd79112: Use regmap_reg_range()
iio: adc: rohm-bd79124: Use regmap_reg_range()

 drivers/iio/adc/rohm-bd79112.c | 13 ++++--------
 drivers/iio/adc/rohm-bd79124.c | 39 ++++++++--------------------------
 2 files changed, 13 insertions(+), 39 deletions(-)
Signature · 1 line
2.51.0
author maintainer
#1 lore raw

PATCH 1/2 iio: adc: rohm-bd79112: Use regmap_reg_range()

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.

---
Compile tested only.

---
 drivers/iio/adc/rohm-bd79112.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/iio/adc/rohm-bd79112.c +4 -9
index d15e06c8b94d..7420aa6627d5 100644
@@ -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 = {
Signature · 1 line
2.51.0
author maintainer
#2 lore raw

PATCH 2/2 iio: adc: rohm-bd79124: Use regmap_reg_range()

In reply to Matti Vaittinen

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.

---
Compile tested only.

---
 drivers/iio/adc/rohm-bd79124.c | 39 ++++++++--------------------------
 1 file changed, 9 insertions(+), 30 deletions(-)
drivers/iio/adc/rohm-bd79124.c +9 -30
index 06c55c8da93f..fc0452749b79 100644
@@ -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 = {
Signature · 1 line
2.51.0
maintainer
#3 lore raw
In reply to Matti Vaittinen
Quoted 7 lines · On Mon, 27 Oct 2025 14:50:07 +0200 Matti Vaittinen <[email protected]>…

Use regmap_reg_range() when initializing regmap_range arrays

Clean-up couple of ROHM drivers which assign the reg_ranges directly. This reduces couple of lines of code.

NOTE: Changes are compile-tested only.

Seem fine, so applied.

Thanks,

Jonathan

Quoted 10 lines

---

Matti Vaittinen (2):
iio: adc: rohm-bd79112: Use regmap_reg_range()
iio: adc: rohm-bd79124: Use regmap_reg_range()

 drivers/iio/adc/rohm-bd79112.c | 13 ++++--------
 drivers/iio/adc/rohm-bd79124.c | 39 ++++++++--------------------------
 2 files changed, 13 insertions(+), 39 deletions(-)