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

regulator: dummy: Constify dummy_initdata and dummy_ops

The only usage of dummy_initdata is to assign its address to the
init_data field of the regulator_config struct and the only usage
dummy_ops is to assign its address to the ops field in the
regulator_desc struct, both which are const pointers. 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/20200913084114.8851-2-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Rikard Falkeborn and committed by
Mark Brown
087c09c2 fd24adf8

+2 -2
+2 -2
drivers/regulator/dummy.c
··· 21 21 22 22 struct regulator_dev *dummy_regulator_rdev; 23 23 24 - static struct regulator_init_data dummy_initdata = { 24 + static const struct regulator_init_data dummy_initdata = { 25 25 .constraints = { 26 26 .always_on = 1, 27 27 }, 28 28 }; 29 29 30 - static struct regulator_ops dummy_ops; 30 + static const struct regulator_ops dummy_ops; 31 31 32 32 static const struct regulator_desc dummy_desc = { 33 33 .name = "regulator-dummy",