Skip to contentSkip to conversation

clk: bcm2835: Constify struct debugfs_reg32

PATCH Applied Rikard Falkeborn 2 participants 2 messages May 8, 2020 – May 27, 2020

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

PATCH 1/1 clk: bcm2835: Constify struct debugfs_reg32

bcm2835_debugfs_clock_reg32 is never changed and can therefore be made const.

This allows the compiler to put it in the text section instead of the data section.

Before:
text data bss dec hex filename
26598 16088 64 42750 a6fe drivers/clk/bcm/clk-bcm2835.o

After:
text data bss dec hex filename
26662 16024 64 42750 a6fe drivers/clk/bcm/clk-bcm2835.o

---
 drivers/clk/bcm/clk-bcm2835.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/bcm/clk-bcm2835.c +3 -3
index ded13ccf768e..7da3b1ba1377 100644
@@ -396,8 +396,8 @@ static unsigned long bcm2835_measure_tcnt_mux(struct bcm2835_cprman *cprman,
 }
 
 static void bcm2835_debugfs_regset(struct bcm2835_cprman *cprman, u32 base,
-				  struct debugfs_reg32 *regs, size_t nregs,
-				  struct dentry *dentry)
+				   const struct debugfs_reg32 *regs,
+				   size_t nregs, struct dentry *dentry)
 {
 	struct debugfs_regset32 *regset;
 
@@ -1240,7 +1240,7 @@ static u8 bcm2835_clock_get_parent(struct clk_hw *hw)
 	return (src & CM_SRC_MASK) >> CM_SRC_SHIFT;
 }
 
-static struct debugfs_reg32 bcm2835_debugfs_clock_reg32[] = {
+static const struct debugfs_reg32 bcm2835_debugfs_clock_reg32[] = {
 	{
 		.name = "ctl",
 		.offset = 0,
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw

Quoting Rikard Falkeborn (2020-05-08 15:02:38)

Quoted 10 lines

bcm2835_debugfs_clock_reg32 is never changed and can therefore be made const.

This allows the compiler to put it in the text section instead of the data section.

Before:
text data bss dec hex filename
26598 16088 64 42750 a6fe drivers/clk/bcm/clk-bcm2835.o

Quoted 6 lines

After:
text data bss dec hex filename
26662 16024 64 42750 a6fe drivers/clk/bcm/clk-bcm2835.o

---

Applied to clk-next