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. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Link: https://lore.kernel.org/r/20220330214110.36337-1-rikard.falkeborn@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
3123109284
commit
bd941dfaae
|
@ -40,7 +40,7 @@ static int regmap_i3c_read(void *context,
|
||||||
return i3c_device_do_priv_xfers(i3c, xfers, 2);
|
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,
|
.write = regmap_i3c_write,
|
||||||
.read = regmap_i3c_read,
|
.read = regmap_i3c_read,
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
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_write = regmap_sccb_write,
|
||||||
.reg_read = regmap_sccb_read,
|
.reg_read = regmap_sccb_read,
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ static int regmap_sdw_mbq_read(void *context, unsigned int reg, unsigned int *va
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct regmap_bus regmap_sdw_mbq = {
|
static const struct regmap_bus regmap_sdw_mbq = {
|
||||||
.reg_read = regmap_sdw_mbq_read,
|
.reg_read = regmap_sdw_mbq_read,
|
||||||
.reg_write = regmap_sdw_mbq_write,
|
.reg_write = regmap_sdw_mbq_write,
|
||||||
.reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
|
.reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
|
||||||
|
|
|
@ -30,7 +30,7 @@ static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct regmap_bus regmap_sdw = {
|
static const struct regmap_bus regmap_sdw = {
|
||||||
.reg_read = regmap_sdw_read,
|
.reg_read = regmap_sdw_read,
|
||||||
.reg_write = regmap_sdw_write,
|
.reg_write = regmap_sdw_write,
|
||||||
.reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
|
.reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
|
||||||
|
|
|
@ -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);
|
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,
|
.write = regmap_slimbus_write,
|
||||||
.read = regmap_slimbus_read,
|
.read = regmap_slimbus_read,
|
||||||
.reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
|
.reg_format_endian_default = REGMAP_ENDIAN_LITTLE,
|
||||||
|
|
|
@ -172,17 +172,17 @@ static int w1_reg_a16_v16_write(void *context, unsigned int reg,
|
||||||
* Various types of supported bus addressing
|
* 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_read = w1_reg_a8_v8_read,
|
||||||
.reg_write = w1_reg_a8_v8_write,
|
.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_read = w1_reg_a8_v16_read,
|
||||||
.reg_write = w1_reg_a8_v16_write,
|
.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_read = w1_reg_a16_v16_read,
|
||||||
.reg_write = w1_reg_a16_v16_write,
|
.reg_write = w1_reg_a16_v16_write,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue