All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: dsa: bcm_sf2: make const array static, makes object smaller
@ 2020-10-20 16:50 ` Colin King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2020-10-20 16:50 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Jakub Kicinski, netdev
  Cc: kernel-janitors, linux-kernel

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(-)

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,
-- 
2.27.0


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

* [PATCH] net: dsa: bcm_sf2: make const array static, makes object smaller
@ 2020-10-20 16:50 ` Colin King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2020-10-20 16:50 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Jakub Kicinski, netdev
  Cc: kernel-janitors, linux-kernel

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(-)

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,
-- 
2.27.0

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

* Re: [PATCH] net: dsa: bcm_sf2: make const array static, makes object smaller
  2020-10-20 16:50 ` Colin King
@ 2020-10-20 16:51   ` Florian Fainelli
  -1 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2020-10-20 16:51 UTC (permalink / raw)
  To: Colin King, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
	David S . Miller, Jakub Kicinski, netdev
  Cc: kernel-janitors, linux-kernel

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>
-- 
Florian

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

* Re: [PATCH] net: dsa: bcm_sf2: make const array static, makes object smaller
@ 2020-10-20 16:51   ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2020-10-20 16:51 UTC (permalink / raw)
  To: Colin King, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
	David S . Miller, Jakub Kicinski, netdev
  Cc: kernel-janitors, linux-kernel

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>
-- 
Florian

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

* Re: [PATCH] net: dsa: bcm_sf2: make const array static, makes object smaller
  2020-10-20 16:51   ` Florian Fainelli
@ 2020-10-21  4:00     ` Jakub Kicinski
  -1 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2020-10-21  4:00 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Colin King, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
	David S . Miller, netdev, kernel-janitors, linux-kernel

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!

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

* Re: [PATCH] net: dsa: bcm_sf2: make const array static, makes object smaller
@ 2020-10-21  4:00     ` Jakub Kicinski
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2020-10-21  4:00 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Colin King, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
	David S . Miller, netdev, kernel-janitors, linux-kernel

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!

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

end of thread, other threads:[~2020-10-21  4:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 16:50 [PATCH] net: dsa: bcm_sf2: make const array static, makes object smaller Colin King
2020-10-20 16:50 ` Colin King
2020-10-20 16:51 ` Florian Fainelli
2020-10-20 16:51   ` Florian Fainelli
2020-10-21  4:00   ` Jakub Kicinski
2020-10-21  4:00     ` Jakub Kicinski

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.