* [PATCH 0/5] regulator: Constify some static struct variables
@ 2020-06-17 22:32 Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 1/5] regulator: anatop: Constify anatop_core_rops Rikard Falkeborn
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-06-17 22:32 UTC (permalink / raw)
Cc: lgirdwood, broonie, linux-kernel, Rikard Falkeborn
Constify some static struct variables to allow the compiler to put them
in read-only memory. There are more of these, but I figured I could
start small. Also, is one patch per driver a good resolution or too
fine-grained?
Rikard Falkeborn (5):
regulator: anatop: Constify anatop_core_rops
regulator: cpcap: Constify cpcap_regulator_ops
regulator: ltc3676: Constify ltc3676_regulators
regulator: max8907: Constify static structs
regulator: max8997: Constify struct regulator_ops
drivers/regulator/anatop-regulator.c | 2 +-
drivers/regulator/cpcap-regulator.c | 2 +-
drivers/regulator/ltc3676.c | 2 +-
drivers/regulator/max8907-regulator.c | 6 +++---
drivers/regulator/max8997-regulator.c | 14 +++++++-------
5 files changed, 13 insertions(+), 13 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] regulator: anatop: Constify anatop_core_rops
2020-06-17 22:32 [PATCH 0/5] regulator: Constify some static struct variables Rikard Falkeborn
@ 2020-06-17 22:32 ` Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 2/5] regulator: cpcap: Constify cpcap_regulator_ops Rikard Falkeborn
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-06-17 22:32 UTC (permalink / raw)
Cc: lgirdwood, broonie, linux-kernel, Rikard Falkeborn
anatop_core_rops is not modified and can therefore be made const which
allows the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
4502 412 0 4914 1332 drivers/regulator/anatop-regulator.o
After:
text data bss dec hex filename
4634 280 0 4914 1332 drivers/regulator/anatop-regulator.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/regulator/anatop-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index ca92b3de0e9c..f9856d4e295f 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -139,7 +139,7 @@ static struct regulator_ops anatop_rops = {
.map_voltage = regulator_map_voltage_linear,
};
-static struct regulator_ops anatop_core_rops = {
+static const struct regulator_ops anatop_core_rops = {
.enable = anatop_regmap_enable,
.disable = anatop_regmap_disable,
.is_enabled = anatop_regmap_is_enabled,
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] regulator: cpcap: Constify cpcap_regulator_ops
2020-06-17 22:32 [PATCH 0/5] regulator: Constify some static struct variables Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 1/5] regulator: anatop: Constify anatop_core_rops Rikard Falkeborn
@ 2020-06-17 22:32 ` Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 3/5] regulator: ltc3676: Constify ltc3676_regulators Rikard Falkeborn
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-06-17 22:32 UTC (permalink / raw)
Cc: lgirdwood, broonie, linux-kernel, Rikard Falkeborn
cpcap_regulator_ops is not modified and can be made const to allow the
compiler to put it in read-only memory.
Before:
text data bss dec hex filename
14472 236 0 14708 3974 drivers/regulator/cpcap-regulator.o
After:
text data bss dec hex filename
14604 104 0 14708 3974 drivers/regulator/cpcap-regulator.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/regulator/cpcap-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c
index f80781d58a28..14642603e755 100644
--- a/drivers/regulator/cpcap-regulator.c
+++ b/drivers/regulator/cpcap-regulator.c
@@ -256,7 +256,7 @@ static int cpcap_regulator_set_mode(struct regulator_dev *rdev,
CPCAP_BIT_AUDIO_LOW_PWR, value);
}
-static struct regulator_ops cpcap_regulator_ops = {
+static const struct regulator_ops cpcap_regulator_ops = {
.enable = cpcap_regulator_enable,
.disable = cpcap_regulator_disable,
.is_enabled = regulator_is_enabled_regmap,
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] regulator: ltc3676: Constify ltc3676_regulators
2020-06-17 22:32 [PATCH 0/5] regulator: Constify some static struct variables Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 1/5] regulator: anatop: Constify anatop_core_rops Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 2/5] regulator: cpcap: Constify cpcap_regulator_ops Rikard Falkeborn
@ 2020-06-17 22:32 ` Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 4/5] regulator: max8907: Constify static structs Rikard Falkeborn
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-06-17 22:32 UTC (permalink / raw)
Cc: lgirdwood, broonie, linux-kernel, Rikard Falkeborn
ltc3676_regulators is not modified and can be made const to allow the
compiler to put it in read-only memory.
Before:
text data bss dec hex filename
4361 2064 8 6433 1921 drivers/regulator/ltc3676.o
After:
text data bss dec hex filename
6121 304 8 6433 1921 drivers/regulator/ltc3676.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/regulator/ltc3676.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/ltc3676.c b/drivers/regulator/ltc3676.c
index e12e52c69e52..093b3e4a6303 100644
--- a/drivers/regulator/ltc3676.c
+++ b/drivers/regulator/ltc3676.c
@@ -221,7 +221,7 @@ static const struct regulator_ops ltc3676_fixed_regulator_ops = {
#define LTC3676_FIXED_REG(_id, _name, _en_reg, _en_bit) \
LTC3676_REG(_id, _name, fixed, LTC3676_ ## _en_reg, _en_bit, 0, 0)
-static struct regulator_desc ltc3676_regulators[LTC3676_NUM_REGULATORS] = {
+static const struct regulator_desc ltc3676_regulators[LTC3676_NUM_REGULATORS] = {
LTC3676_LINEAR_REG(SW1, sw1, BUCK1, DVB1A),
LTC3676_LINEAR_REG(SW2, sw2, BUCK2, DVB2A),
LTC3676_LINEAR_REG(SW3, sw3, BUCK3, DVB3A),
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] regulator: max8907: Constify static structs
2020-06-17 22:32 [PATCH 0/5] regulator: Constify some static struct variables Rikard Falkeborn
` (2 preceding siblings ...)
2020-06-17 22:32 ` [PATCH 3/5] regulator: ltc3676: Constify ltc3676_regulators Rikard Falkeborn
@ 2020-06-17 22:32 ` Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 5/5] regulator: max8997: Constify struct regulator_ops Rikard Falkeborn
2020-06-18 13:09 ` [PATCH 0/5] regulator: Constify some static struct variables Mark Brown
5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-06-17 22:32 UTC (permalink / raw)
Cc: lgirdwood, broonie, linux-kernel, Rikard Falkeborn
These are not modified so make them const to allow the compiler to put
them in read-only memory.
Before:
text data bss dec hex filename
2753 7328 0 10081 2761 drivers/regulator/max8907-regulator.o
After:
text data bss dec hex filename
9405 684 0 10089 2769 drivers/regulator/max8907-regulator.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/regulator/max8907-regulator.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
index 96dc0eea7659..1a6fd68f3fb1 100644
--- a/drivers/regulator/max8907-regulator.c
+++ b/drivers/regulator/max8907-regulator.c
@@ -109,7 +109,7 @@ struct max8907_regulator {
static const struct regulator_ops max8907_mbatt_ops = {
};
-static struct regulator_ops max8907_ldo_ops = {
+static const struct regulator_ops max8907_ldo_ops = {
.list_voltage = regulator_list_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
@@ -128,7 +128,7 @@ static const struct regulator_ops max8907_fixed_ops = {
.list_voltage = regulator_list_voltage_linear,
};
-static struct regulator_ops max8907_out5v_ops = {
+static const struct regulator_ops max8907_out5v_ops = {
.list_voltage = regulator_list_voltage_linear,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@@ -145,7 +145,7 @@ static const struct regulator_ops max8907_bbat_ops = {
.get_voltage_sel = regulator_get_voltage_sel_regmap,
};
-static struct regulator_desc max8907_regulators[] = {
+static const struct regulator_desc max8907_regulators[] = {
REG_MBATT(),
REG_LDO(SD1, "in-v1", MAX8907_REG_SDCTL1, 650000, 2225000, 25000),
REG_LDO(SD2, "in-v2", MAX8907_REG_SDCTL2, 637500, 1425000, 12500),
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] regulator: max8997: Constify struct regulator_ops
2020-06-17 22:32 [PATCH 0/5] regulator: Constify some static struct variables Rikard Falkeborn
` (3 preceding siblings ...)
2020-06-17 22:32 ` [PATCH 4/5] regulator: max8907: Constify static structs Rikard Falkeborn
@ 2020-06-17 22:32 ` Rikard Falkeborn
2020-06-18 13:09 ` [PATCH 0/5] regulator: Constify some static struct variables Mark Brown
5 siblings, 0 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2020-06-17 22:32 UTC (permalink / raw)
Cc: lgirdwood, broonie, linux-kernel, Rikard Falkeborn
These are not modified so make them const to allow the compiler to put
them in read-only memory.
Before:
text data bss dec hex filename
13114 8596 0 21710 54ce drivers/regulator/max8997-regulator.o
After:
text data bss dec hex filename
14038 7672 0 21710 54ce drivers/regulator/max8997-regulator.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/regulator/max8997-regulator.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/regulator/max8997-regulator.c b/drivers/regulator/max8997-regulator.c
index 4d2487279a0a..ba47a5e2fbcb 100644
--- a/drivers/regulator/max8997-regulator.c
+++ b/drivers/regulator/max8997-regulator.c
@@ -732,7 +732,7 @@ static int max8997_reg_disable_suspend(struct regulator_dev *rdev)
return max8997_update_reg(i2c, reg, ~pattern, mask);
}
-static struct regulator_ops max8997_ldo_ops = {
+static const struct regulator_ops max8997_ldo_ops = {
.list_voltage = max8997_list_voltage,
.is_enabled = max8997_reg_is_enabled,
.enable = max8997_reg_enable,
@@ -742,7 +742,7 @@ static struct regulator_ops max8997_ldo_ops = {
.set_suspend_disable = max8997_reg_disable_suspend,
};
-static struct regulator_ops max8997_buck_ops = {
+static const struct regulator_ops max8997_buck_ops = {
.list_voltage = max8997_list_voltage,
.is_enabled = max8997_reg_is_enabled,
.enable = max8997_reg_enable,
@@ -753,7 +753,7 @@ static struct regulator_ops max8997_buck_ops = {
.set_suspend_disable = max8997_reg_disable_suspend,
};
-static struct regulator_ops max8997_fixedvolt_ops = {
+static const struct regulator_ops max8997_fixedvolt_ops = {
.list_voltage = max8997_list_voltage,
.is_enabled = max8997_reg_is_enabled,
.enable = max8997_reg_enable,
@@ -761,7 +761,7 @@ static struct regulator_ops max8997_fixedvolt_ops = {
.set_suspend_disable = max8997_reg_disable_suspend,
};
-static struct regulator_ops max8997_safeout_ops = {
+static const struct regulator_ops max8997_safeout_ops = {
.list_voltage = regulator_list_voltage_table,
.is_enabled = max8997_reg_is_enabled,
.enable = max8997_reg_enable,
@@ -771,7 +771,7 @@ static struct regulator_ops max8997_safeout_ops = {
.set_suspend_disable = max8997_reg_disable_suspend,
};
-static struct regulator_ops max8997_fixedstate_ops = {
+static const struct regulator_ops max8997_fixedstate_ops = {
.list_voltage = max8997_list_voltage_charger_cv,
.get_voltage_sel = max8997_get_voltage_sel,
.set_voltage = max8997_set_voltage_charger_cv,
@@ -805,7 +805,7 @@ static int max8997_get_current_limit(struct regulator_dev *rdev)
return max8997_list_voltage(rdev, sel);
}
-static struct regulator_ops max8997_charger_ops = {
+static const struct regulator_ops max8997_charger_ops = {
.is_enabled = max8997_reg_is_enabled,
.enable = max8997_reg_enable,
.disable = max8997_reg_disable,
@@ -813,7 +813,7 @@ static struct regulator_ops max8997_charger_ops = {
.set_current_limit = max8997_set_current_limit,
};
-static struct regulator_ops max8997_charger_fixedstate_ops = {
+static const struct regulator_ops max8997_charger_fixedstate_ops = {
.get_current_limit = max8997_get_current_limit,
.set_current_limit = max8997_set_current_limit,
};
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/5] regulator: Constify some static struct variables
2020-06-17 22:32 [PATCH 0/5] regulator: Constify some static struct variables Rikard Falkeborn
` (4 preceding siblings ...)
2020-06-17 22:32 ` [PATCH 5/5] regulator: max8997: Constify struct regulator_ops Rikard Falkeborn
@ 2020-06-18 13:09 ` Mark Brown
5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-06-18 13:09 UTC (permalink / raw)
To: Rikard Falkeborn; +Cc: linux-kernel, lgirdwood
On Thu, 18 Jun 2020 00:32:42 +0200, Rikard Falkeborn wrote:
> Constify some static struct variables to allow the compiler to put them
> in read-only memory. There are more of these, but I figured I could
> start small. Also, is one patch per driver a good resolution or too
> fine-grained?
>
> Rikard Falkeborn (5):
> regulator: anatop: Constify anatop_core_rops
> regulator: cpcap: Constify cpcap_regulator_ops
> regulator: ltc3676: Constify ltc3676_regulators
> regulator: max8907: Constify static structs
> regulator: max8997: Constify struct regulator_ops
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/5] regulator: anatop: Constify anatop_core_rops
commit: cae62a937912bd4b3faf8e268cc0ffcf00ec5850
[2/5] regulator: cpcap: Constify cpcap_regulator_ops
commit: bcf39c1eb1e059ec612bf06f4aa7b3972dcc85e8
[3/5] regulator: ltc3676: Constify ltc3676_regulators
commit: b37f076d4bfdd29b3aa497480b226759f659e25f
[4/5] regulator: max8907: Constify static structs
commit: b08af72d6e5319e96527816c4b3b08d0b1a6f242
[5/5] regulator: max8997: Constify struct regulator_ops
commit: 9ed84d24de480e81294e00814c142234bc17ce0c
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-06-18 13:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 22:32 [PATCH 0/5] regulator: Constify some static struct variables Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 1/5] regulator: anatop: Constify anatop_core_rops Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 2/5] regulator: cpcap: Constify cpcap_regulator_ops Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 3/5] regulator: ltc3676: Constify ltc3676_regulators Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 4/5] regulator: max8907: Constify static structs Rikard Falkeborn
2020-06-17 22:32 ` [PATCH 5/5] regulator: max8997: Constify struct regulator_ops Rikard Falkeborn
2020-06-18 13:09 ` [PATCH 0/5] regulator: Constify some static struct variables Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).