All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] drivers/regulator: Constify static variables
@ 2020-09-13  8:41 Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 1/5] regulator: dummy: Constify dummy_initdata and dummy_ops Rikard Falkeborn
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-09-13  8:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Rikard Falkeborn

Constify a couple of static variables, most importantly regulator_ops to
allow the compiler to put them in read-only memory.

Rikard Falkeborn (5):
  regulator: dummy: Constify dummy_initdata and dummy_ops
  regulator: fixed: Constify static regulator_ops
  regulator: stw481x-vmmc: Constify static structs
  regulator: pca9450: Constify static regulator_ops
  regulator: ti-abb: Constify ti_abb_reg_ops

 drivers/regulator/dummy.c             | 4 ++--
 drivers/regulator/fixed.c             | 4 ++--
 drivers/regulator/pca9450-regulator.c | 6 +++---
 drivers/regulator/stw481x-vmmc.c      | 4 ++--
 drivers/regulator/ti-abb-regulator.c  | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] regulator: dummy: Constify dummy_initdata and dummy_ops
  2020-09-13  8:41 [PATCH 0/5] drivers/regulator: Constify static variables Rikard Falkeborn
@ 2020-09-13  8:41 ` Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 2/5] regulator: fixed: Constify static regulator_ops Rikard Falkeborn
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-09-13  8:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Rikard Falkeborn

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>
---
 drivers/regulator/dummy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/dummy.c b/drivers/regulator/dummy.c
index 74de6983c61a..d8059f596391 100644
--- a/drivers/regulator/dummy.c
+++ b/drivers/regulator/dummy.c
@@ -21,13 +21,13 @@
 
 struct regulator_dev *dummy_regulator_rdev;
 
-static struct regulator_init_data dummy_initdata = {
+static const struct regulator_init_data dummy_initdata = {
 	.constraints = {
 		.always_on = 1,
 	},
 };
 
-static struct regulator_ops dummy_ops;
+static const struct regulator_ops dummy_ops;
 
 static const struct regulator_desc dummy_desc = {
 	.name = "regulator-dummy",
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] regulator: fixed: Constify static regulator_ops
  2020-09-13  8:41 [PATCH 0/5] drivers/regulator: Constify static variables Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 1/5] regulator: dummy: Constify dummy_initdata and dummy_ops Rikard Falkeborn
@ 2020-09-13  8:41 ` Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 3/5] regulator: stw481x-vmmc: Constify static structs Rikard Falkeborn
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-09-13  8:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Rikard Falkeborn

The only usage of fixed_voltage_ops and fixed_voltage_clkenabled_ops is
to assign their address the ops field in the regulator_desc struct,
which is a const pointer. Make them const to allow the compiler to put
them in read-only memory.
make them const to allow the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/regulator/fixed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 5a03fd86ad0a..3de7709bdcd4 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -123,10 +123,10 @@ of_get_fixed_voltage_config(struct device *dev,
 	return config;
 }
 
-static struct regulator_ops fixed_voltage_ops = {
+static const struct regulator_ops fixed_voltage_ops = {
 };
 
-static struct regulator_ops fixed_voltage_clkenabled_ops = {
+static const struct regulator_ops fixed_voltage_clkenabled_ops = {
 	.enable = reg_clock_enable,
 	.disable = reg_clock_disable,
 	.is_enabled = reg_clock_is_enabled,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] regulator: stw481x-vmmc: Constify static structs
  2020-09-13  8:41 [PATCH 0/5] drivers/regulator: Constify static variables Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 1/5] regulator: dummy: Constify dummy_initdata and dummy_ops Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 2/5] regulator: fixed: Constify static regulator_ops Rikard Falkeborn
@ 2020-09-13  8:41 ` Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 4/5] regulator: pca9450: Constify static regulator_ops Rikard Falkeborn
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-09-13  8:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Rikard Falkeborn

The only usage of stw481x_vmmc_ops is to assign its address to the ops
field in the regulator_desc struct which is a const pointer.

The only usage of vmmc_regulator is to pass its address to
of_get_regulator_init_data() and devm_regulator_register(), both which
take const pointers.

Make both of them const to allow the compiler to put them in read-only
memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/regulator/stw481x-vmmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/stw481x-vmmc.c b/drivers/regulator/stw481x-vmmc.c
index 6dc2316daad3..127ab43add49 100644
--- a/drivers/regulator/stw481x-vmmc.c
+++ b/drivers/regulator/stw481x-vmmc.c
@@ -27,7 +27,7 @@ static const unsigned int stw481x_vmmc_voltages[] = {
 	3300000,
 };
 
-static struct regulator_ops stw481x_vmmc_ops = {
+static const struct regulator_ops stw481x_vmmc_ops = {
 	.list_voltage = regulator_list_voltage_table,
 	.enable      = regulator_enable_regmap,
 	.disable     = regulator_disable_regmap,
@@ -36,7 +36,7 @@ static struct regulator_ops stw481x_vmmc_ops = {
 	.set_voltage_sel = regulator_set_voltage_sel_regmap,
 };
 
-static struct regulator_desc vmmc_regulator = {
+static const struct regulator_desc vmmc_regulator = {
 	.name = "VMMC",
 	.id   = 0,
 	.ops  = &stw481x_vmmc_ops,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] regulator: pca9450: Constify static regulator_ops
  2020-09-13  8:41 [PATCH 0/5] drivers/regulator: Constify static variables Rikard Falkeborn
                   ` (2 preceding siblings ...)
  2020-09-13  8:41 ` [PATCH 3/5] regulator: stw481x-vmmc: Constify static structs Rikard Falkeborn
@ 2020-09-13  8:41 ` Rikard Falkeborn
  2020-09-13  8:41 ` [PATCH 5/5] regulator: ti-abb: Constify ti_abb_reg_ops Rikard Falkeborn
  2020-09-14 14:51 ` [PATCH 0/5] drivers/regulator: Constify static variables Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-09-13  8:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Rikard Falkeborn

The only usages of these is to assign their address to the ops field in
the regulator_desc struct, which is a const pointer. Make them const to
allow the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/regulator/pca9450-regulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index eb5822bf53e0..cb29421d745a 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -90,7 +90,7 @@ static int pca9450_dvs_set_ramp_delay(struct regulator_dev *rdev,
 				  BUCK1_RAMP_MASK, ramp_value << 6);
 }
 
-static struct regulator_ops pca9450_dvs_buck_regulator_ops = {
+static const struct regulator_ops pca9450_dvs_buck_regulator_ops = {
 	.enable = regulator_enable_regmap,
 	.disable = regulator_disable_regmap,
 	.is_enabled = regulator_is_enabled_regmap,
@@ -101,7 +101,7 @@ static struct regulator_ops pca9450_dvs_buck_regulator_ops = {
 	.set_ramp_delay = pca9450_dvs_set_ramp_delay,
 };
 
-static struct regulator_ops pca9450_buck_regulator_ops = {
+static const struct regulator_ops pca9450_buck_regulator_ops = {
 	.enable = regulator_enable_regmap,
 	.disable = regulator_disable_regmap,
 	.is_enabled = regulator_is_enabled_regmap,
@@ -111,7 +111,7 @@ static struct regulator_ops pca9450_buck_regulator_ops = {
 	.set_voltage_time_sel = regulator_set_voltage_time_sel,
 };
 
-static struct regulator_ops pca9450_ldo_regulator_ops = {
+static const struct regulator_ops pca9450_ldo_regulator_ops = {
 	.enable = regulator_enable_regmap,
 	.disable = regulator_disable_regmap,
 	.is_enabled = regulator_is_enabled_regmap,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] regulator: ti-abb: Constify ti_abb_reg_ops
  2020-09-13  8:41 [PATCH 0/5] drivers/regulator: Constify static variables Rikard Falkeborn
                   ` (3 preceding siblings ...)
  2020-09-13  8:41 ` [PATCH 4/5] regulator: pca9450: Constify static regulator_ops Rikard Falkeborn
@ 2020-09-13  8:41 ` Rikard Falkeborn
  2020-09-14 14:51 ` [PATCH 0/5] drivers/regulator: Constify static variables Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-09-13  8:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Rikard Falkeborn

The only usage of ti_abb_reg_ops is to assign its address to the ops
field in the regulator_desc struct, which is a const pointer. Make it
const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/regulator/ti-abb-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
index af9abcd9c166..3e60bff76194 100644
--- a/drivers/regulator/ti-abb-regulator.c
+++ b/drivers/regulator/ti-abb-regulator.c
@@ -619,7 +619,7 @@ static int ti_abb_init_table(struct device *dev, struct ti_abb *abb,
 	return 0;
 }
 
-static struct regulator_ops ti_abb_reg_ops = {
+static const struct regulator_ops ti_abb_reg_ops = {
 	.list_voltage = regulator_list_voltage_table,
 
 	.set_voltage_sel = ti_abb_set_voltage_sel,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] drivers/regulator: Constify static variables
  2020-09-13  8:41 [PATCH 0/5] drivers/regulator: Constify static variables Rikard Falkeborn
                   ` (4 preceding siblings ...)
  2020-09-13  8:41 ` [PATCH 5/5] regulator: ti-abb: Constify ti_abb_reg_ops Rikard Falkeborn
@ 2020-09-14 14:51 ` Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-09-14 14:51 UTC (permalink / raw)
  To: Rikard Falkeborn; +Cc: Liam Girdwood, linux-kernel

On Sun, 13 Sep 2020 10:41:09 +0200, Rikard Falkeborn wrote:
> Constify a couple of static variables, most importantly regulator_ops to
> allow the compiler to put them in read-only memory.
> 
> Rikard Falkeborn (5):
>   regulator: dummy: Constify dummy_initdata and dummy_ops
>   regulator: fixed: Constify static regulator_ops
>   regulator: stw481x-vmmc: Constify static structs
>   regulator: pca9450: Constify static regulator_ops
>   regulator: ti-abb: Constify ti_abb_reg_ops
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/5] regulator: dummy: Constify dummy_initdata and dummy_ops
      commit: 087c09c2d273823bac906d590280f7e8052f7eff
[2/5] regulator: fixed: Constify static regulator_ops
      commit: 96ee75ffd4f63a3d5f9d6a3ea592b2c0ee97acb0
[3/5] regulator: stw481x-vmmc: Constify static structs
      commit: 9032693e218e69a9527fd5d08c4ce5cdbe90820f
[4/5] regulator: pca9450: Constify static regulator_ops
      commit: 72f2746c52e3fa6c0f6740df2d4fb70419533084
[5/5] regulator: ti-abb: Constify ti_abb_reg_ops
      commit: 2b37a18b58ed12b711591ec54c2b2a0e2068cf6e

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-14 14:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13  8:41 [PATCH 0/5] drivers/regulator: Constify static variables Rikard Falkeborn
2020-09-13  8:41 ` [PATCH 1/5] regulator: dummy: Constify dummy_initdata and dummy_ops Rikard Falkeborn
2020-09-13  8:41 ` [PATCH 2/5] regulator: fixed: Constify static regulator_ops Rikard Falkeborn
2020-09-13  8:41 ` [PATCH 3/5] regulator: stw481x-vmmc: Constify static structs Rikard Falkeborn
2020-09-13  8:41 ` [PATCH 4/5] regulator: pca9450: Constify static regulator_ops Rikard Falkeborn
2020-09-13  8:41 ` [PATCH 5/5] regulator: ti-abb: Constify ti_abb_reg_ops Rikard Falkeborn
2020-09-14 14:51 ` [PATCH 0/5] drivers/regulator: Constify static variables Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.