diff mbox series

net: dsa: bcm_sf2: make const array static, makes object smaller

Message ID 20201020165029.56383-1-colin.king@canonical.com
State Accepted
Delegated to: David Miller
Headers show
Series net: dsa: bcm_sf2: make const array static, makes object smaller | expand

Checks

Context Check Description
jkicinski/cover_letter success Link
jkicinski/fixes_present success Link
jkicinski/patch_count success Link
jkicinski/tree_selection success Guessed tree name to be net-next
jkicinski/subject_prefix warning Target tree name not specified in the subject
jkicinski/source_inline success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/module_param success Was 0 now: 0
jkicinski/build_32bit success Errors and warnings before: 0 this patch: 0
jkicinski/kdoc success Errors and warnings before: 0 this patch: 0
jkicinski/verify_fixes success Link
jkicinski/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
jkicinski/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jkicinski/header_inline success Link
jkicinski/stable success Stable not CCed

Commit Message

Colin Ian King Oct. 20, 2020, 4:50 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Don't populate the const array rate_table on the stack but instead it
static. Makes the object code smaller by 46 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
  29812	   3824	    192	  33828	   8424	drivers/net/dsa/bcm_sf2.o

After:
   text	   data	    bss	    dec	    hex	filename
  29670	   3920	    192	  33782	   83f6	drivers/net/dsa/bcm_sf2.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/dsa/bcm_sf2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Fainelli Oct. 20, 2020, 4:51 p.m. UTC | #1
On 10/20/20 9:50 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const array rate_table on the stack but instead it
> static. Makes the object code smaller by 46 bytes.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   29812	   3824	    192	  33828	   8424	drivers/net/dsa/bcm_sf2.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   29670	   3920	    192	  33782	   83f6	drivers/net/dsa/bcm_sf2.o
> 
> (gcc version 10.2.0)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Jakub Kicinski Oct. 21, 2020, 4 a.m. UTC | #2
On Tue, 20 Oct 2020 09:51:39 -0700 Florian Fainelli wrote:
> On 10/20/20 9:50 AM, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > Don't populate the const array rate_table on the stack but instead it
> > static. Makes the object code smaller by 46 bytes.
> > 
> > Before:
> >    text	   data	    bss	    dec	    hex	filename
> >   29812	   3824	    192	  33828	   8424	drivers/net/dsa/bcm_sf2.o
> > 
> > After:
> >    text	   data	    bss	    dec	    hex	filename
> >   29670	   3920	    192	  33782	   83f6	drivers/net/dsa/bcm_sf2.o
> > 
> > (gcc version 10.2.0)
> > 
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>  
> 
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks!
diff mbox series

Patch

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 0b5b2b33b3b6..1e9a0adda2d6 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -54,7 +54,7 @@  static void bcm_sf2_recalc_clock(struct dsa_switch *ds)
 	unsigned long new_rate;
 	unsigned int ports_active;
 	/* Frequenty in Mhz */
-	const unsigned long rate_table[] = {
+	static const unsigned long rate_table[] = {
 		59220000,
 		60820000,
 		62500000,