Skip to contentSkip to conversation

mfd: bd718x7: Use regmap_reg_range()

PATCH Applied Matti Vaittinen 2 participants 2 messages Oct 27, 2025 – Nov 6, 2025

Subsystems (2)
lore
Share & tools
lore

Matti Vaittinen

author maintainer
#0 lore raw

PATCH 1/1 mfd: bd718x7: Use regmap_reg_range()

Initializing the regmap_ranges using direct assignment to the range_min and range_max members is a slightly verbose. In general we can make it a tad cleaner when using the regmap_reg_range() macro.

The rohm-bd718x7.c is doing this open-coded initialization. It's not really bad as there is only one range defined, but it is still worth converting it to use the regmap_reg_range() so no-one uses it as a bad example.

Additionally, the regmap_access_table expects a pointer to an array of ranges. This is a tad more obvious when we use an array with single range, instead of claiming a pointer to a range struct being a single element array.

Use regmap_reg_range() when initializing the regmap_range structure and use a real one-element array instead of a pointer to a struct.

---
 drivers/mfd/rohm-bd718x7.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/mfd/rohm-bd718x7.c +4 -5
index 25e494a93d48..ff714fd4f54d 100644
@@ -72,14 +72,13 @@ static const struct regmap_irq_chip bd718xx_irq_chip = {
 	.init_ack_masked = true,
 };
 
-static const struct regmap_range pmic_status_range = {
-	.range_min = BD718XX_REG_IRQ,
-	.range_max = BD718XX_REG_POW_STATE,
+static const struct regmap_range pmic_status_range[] = {
+	regmap_reg_range(BD718XX_REG_IRQ, BD718XX_REG_POW_STATE),
 };
 
 static const struct regmap_access_table volatile_regs = {
-	.yes_ranges = &pmic_status_range,
-	.n_yes_ranges = 1,
+	.yes_ranges = &pmic_status_range[0],
+	.n_yes_ranges = ARRAY_SIZE(pmic_status_range),
 };
 
 static const struct regmap_config bd718xx_regmap_config = {
Signature · 1 line
2.51.0
maintainer Applied
#1 lore raw

Re: (subset) [PATCH] mfd: bd718x7: Use regmap_reg_range()

Quoted 10 lines · Matti Vaittinen

Initializing the regmap_ranges using direct assignment to the range_min and range_max members is a slightly verbose. In general we can make it a tad cleaner when using the regmap_reg_range() macro.

The rohm-bd718x7.c is doing this open-coded initialization. It's not really bad as there is only one range defined, but it is still worth converting it to use the regmap_reg_range() so no-one uses it as a bad example.

[...]

Applied, thanks!

[1/1] mfd: bd718x7: Use regmap_reg_range()

      commit: 1810b210872ffc9985febca0880702a7102aad31

--
Lee Jones [李琼斯]