Patchwork drivers/video/fbdev/atyfb: make const arrays static, reduces object code size

login
register
mail settings
Submitter Colin Ian King
Date Sept. 13, 2017, 3:03 p.m.
Message ID <20170913150309.6250-1-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/9951515/
State New
Headers show

Comments

Colin Ian King - Sept. 13, 2017, 3:03 p.m.
From: Colin Ian King <colin.king@canonical.com>

Don't populate the const arrays ragepro_tbl and ragexl_tbl on the stack,
instead make them static.  Makes the object code smaller by over 380 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  41089	  10592	    768	  52449	   cce1 atyfb_base.o

After:
   text	   data	    bss	    dec	    hex	filename
  40544	  10752	    768	  52064	   cb60	atyfb_base.o

(gcc version 7.2.0, x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/video/fbdev/aty/atyfb_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Bartlomiej Zolnierkiewicz - Oct. 12, 2017, 3:26 p.m.
On Wednesday, September 13, 2017 04:03:09 PM Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const arrays ragepro_tbl and ragexl_tbl on the stack,
> instead make them static.  Makes the object code smaller by over 380 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   41089	  10592	    768	  52449	   cce1 atyfb_base.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   40544	  10752	    768	  52064	   cb60	atyfb_base.o
> 
> (gcc version 7.2.0, x86_64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch queued for 4.15 (with patch description fixed to
"video: fbdev: aty: ..." for consistency with other patches),
thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Patch

diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index 3ec72f19114b..a9a8272f7a6e 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -2272,10 +2272,10 @@  static void aty_bl_exit(struct backlight_device *bd)
 
 static void aty_calc_mem_refresh(struct atyfb_par *par, int xclk)
 {
-	const int ragepro_tbl[] = {
+	static const int ragepro_tbl[] = {
 		44, 50, 55, 66, 75, 80, 100
 	};
-	const int ragexl_tbl[] = {
+	static const int ragexl_tbl[] = {
 		50, 66, 75, 83, 90, 95, 100, 105,
 		110, 115, 120, 125, 133, 143, 166
 	};