Skip to contentSkip to conversation

phy: allwinner: phy-sun6i-mipi-dphy: Constify structs

PATCH Applied Rikard Falkeborn 3 participants 3 messages Jun 29, 2020 – Jul 8, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: allwinner: phy-sun6i-mipi-dphy: Constify structs

sun6i_dphy_ops and sun6i_dphy_regmap_config are not modified so make them const structs to allow the compiler to put them in read-only memory.

Before:
text data bss dec hex filename
4407 1944 64 6415 190f drivers/phy/allwinner/phy-sun6i-mipi-dphy.o

After:
text data bss dec hex filename
4835 1496 64 6395 18fb drivers/phy/allwinner/phy-sun6i-mipi-dphy.o

---
 drivers/phy/allwinner/phy-sun6i-mipi-dphy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/allwinner/phy-sun6i-mipi-dphy.c +2 -2
index 79c8af5c7c1d..1fa761ba6cbb 100644
@@ -233,7 +233,7 @@ static int sun6i_dphy_exit(struct phy *phy)
 }
 
 
-static struct phy_ops sun6i_dphy_ops = {
+static const struct phy_ops sun6i_dphy_ops = {
 	.configure	= sun6i_dphy_configure,
 	.power_on	= sun6i_dphy_power_on,
 	.power_off	= sun6i_dphy_power_off,
@@ -241,7 +241,7 @@ static struct phy_ops sun6i_dphy_ops = {
 	.exit		= sun6i_dphy_exit,
 };
 
-static struct regmap_config sun6i_dphy_regmap_config = {
+static const struct regmap_config sun6i_dphy_regmap_config = {
 	.reg_bits	= 32,
 	.val_bits	= 32,
 	.reg_stride	= 4,
Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Rikard Falkeborn

sun6i_dphy_ops and sun6i_dphy_regmap_config are not modified so make them const structs to allow the compiler to put them in read-only memory.

Before:
text data bss dec hex filename
4407 1944 64 6415 190f drivers/phy/allwinner/phy-sun6i-mipi-dphy.o

Quoted 5 lines

After:
text data bss dec hex filename
4835 1496 64 6395 18fb drivers/phy/allwinner/phy-sun6i-mipi-dphy.o

Thanks!
Maxime

maintainer Applied
#2 lore raw
In reply to Rikard Falkeborn
Quoted 10 lines · Rikard Falkeborn

sun6i_dphy_ops and sun6i_dphy_regmap_config are not modified so make them const structs to allow the compiler to put them in read-only memory.

Before:
text data bss dec hex filename
4407 1944 64 6415 190f drivers/phy/allwinner/phy-sun6i-mipi-dphy.o

After:
text data bss dec hex filename
4835 1496 64 6395 18fb drivers/phy/allwinner/phy-sun6i-mipi-dphy.o

Applied, thanks

Signature · 1 line
~Vinod