regmap: Constify static regmap_bus structs
Subsystems (2)
PATCH 1/1 regmap: Constify static regmap_bus structs
The only usage of these is to pass their address to __regmap_init() or __devm_regmap_init(), both which takes pointers to const struct regmap_bus. Make them const to allow the compiler to put them in read-only memory.
--- drivers/base/regmap/regmap-i3c.c | 2 +- drivers/base/regmap/regmap-sccb.c | 2 +- drivers/base/regmap/regmap-sdw-mbq.c | 2 +- drivers/base/regmap/regmap-sdw.c | 2 +- drivers/base/regmap/regmap-slimbus.c | 2 +- drivers/base/regmap/regmap-w1.c | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-)
drivers/base/regmap/regmap-i3c.c +1 -1
@@ -40,7 +40,7 @@ static int regmap_i3c_read(void *context,return i3c_device_do_priv_xfers (i3c, xfers,2 ); } -static struct regmap_bus regmap_i3c = { +static const struct regmap_bus regmap_i3c = { .write = regmap_i3c_write, .read = regmap_i3c_read, };
drivers/base/regmap/regmap-sccb.c +1 -1
@@ -80,7 +80,7 @@ static int regmap_sccb_write(void *context, unsigned int reg, unsigned int val)return i2c_smbus_write_byte_data (i2c, reg, val); } -static struct regmap_bus regmap_sccb_bus = { +static const struct regmap_bus regmap_sccb_bus = { .reg_write = regmap_sccb_write, .reg_read = regmap_sccb_read, };
drivers/base/regmap/regmap-sdw-mbq.c +1 -1
@@ -42,7 +42,7 @@ static int regmap_sdw_mbq_read(void *context, unsigned int reg, unsigned int *vareturn 0 ; } -static struct regmap_bus regmap_sdw_mbq = { +static const struct regmap_bus regmap_sdw_mbq = { .reg_read = regmap_sdw_mbq_read, .reg_write = regmap_sdw_mbq_write, .reg_format_endian_default =REGMAP_ENDIAN_LITTLE ,
drivers/base/regmap/regmap-sdw.c +1 -1
@@ -30,7 +30,7 @@ static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val)return 0 ; } -static struct regmap_bus regmap_sdw = { +static const struct regmap_bus regmap_sdw = { .reg_read = regmap_sdw_read, .reg_write = regmap_sdw_write, .reg_format_endian_default =REGMAP_ENDIAN_LITTLE ,
drivers/base/regmap/regmap-slimbus.c +1 -1
@@ -22,7 +22,7 @@ static int regmap_slimbus_read(void *context, const void *reg, size_t reg_size,return slim_read (sdev, *(u16 *)reg, val_size, val); } -static struct regmap_bus regmap_slimbus_bus = { +static const struct regmap_bus regmap_slimbus_bus = { .write = regmap_slimbus_write, .read = regmap_slimbus_read, .reg_format_endian_default =REGMAP_ENDIAN_LITTLE ,
drivers/base/regmap/regmap-w1.c +3 -3
@@ -172,17 +172,17 @@ static int w1_reg_a16_v16_write(void *context, unsigned int reg,* Various types of supported bus addressing */ -static struct regmap_bus regmap_w1_bus_a8_v8 = { +static const struct regmap_bus regmap_w1_bus_a8_v8 = { .reg_read = w1_reg_a8_v8_read, .reg_write = w1_reg_a8_v8_write, }; -static struct regmap_bus regmap_w1_bus_a8_v16 = { +static const struct regmap_bus regmap_w1_bus_a8_v16 = { .reg_read = w1_reg_a8_v16_read, .reg_write = w1_reg_a8_v16_write, }; -static struct regmap_bus regmap_w1_bus_a16_v16 = { +static const struct regmap_bus regmap_w1_bus_a16_v16 = { .reg_read = w1_reg_a16_v16_read, .reg_write = w1_reg_a16_v16_write, };
Signature · 1 line
2.35.1
Mark Brown
maintainerQuoted 6 lines · Rikard Falkeborn
The only usage of these is to pass their address to
__regmap_init()or__devm_regmap_init(), both which takes pointers to const structregmap_bus. Make them const to allow the compiler to put them in read-only memory.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap: Constify static regmap_bus structs
commit: bd941dfaae3503c6b707d8544696205f759e57a3
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark