Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: bd718x7: Use regmap_reg_range() for pmic_status_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.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/aP9hlpRO-0vmEHBZ@mva-rohm
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Matti Vaittinen and committed by
Lee Jones
1810b210 049929c5

+4 -5
+4 -5
drivers/mfd/rohm-bd718x7.c
··· 72 72 .init_ack_masked = true, 73 73 }; 74 74 75 - static const struct regmap_range pmic_status_range = { 76 - .range_min = BD718XX_REG_IRQ, 77 - .range_max = BD718XX_REG_POW_STATE, 75 + static const struct regmap_range pmic_status_range[] = { 76 + regmap_reg_range(BD718XX_REG_IRQ, BD718XX_REG_POW_STATE), 78 77 }; 79 78 80 79 static const struct regmap_access_table volatile_regs = { 81 - .yes_ranges = &pmic_status_range, 82 - .n_yes_ranges = 1, 80 + .yes_ranges = &pmic_status_range[0], 81 + .n_yes_ranges = ARRAY_SIZE(pmic_status_range), 83 82 }; 84 83 85 84 static const struct regmap_config bd718xx_regmap_config = {