Patchwork video: fbdev: sis: make const array specialtv static, reduces object code size

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

Comments

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

Don't populate the const array specialtv on the stack, instead make it
static.  Makes the object code smaller by over 1100 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
 179899	   7504	      0	 187403	  2dc0b	drivers/video/fbdev/sis/init301.o

After:
   text	   data	    bss	    dec	    hex	filename
 178720	   7568	      0	 186288	  2d7b0	drivers/video/fbdev/sis/init301.o

(gcc version 7.2.0, x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/video/fbdev/sis/init301.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Bartlomiej Zolnierkiewicz - Oct. 12, 2017, 3:30 p.m.
On Wednesday, September 13, 2017 04:41:37 PM Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const array specialtv on the stack, instead make it
> static.  Makes the object code smaller by over 1100 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>  179899	   7504	      0	 187403	  2dc0b	drivers/video/fbdev/sis/init301.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>  178720	   7568	      0	 186288	  2d7b0	drivers/video/fbdev/sis/init301.o
> 
> (gcc version 7.2.0, x86_64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch queued for 4.15, thanks.

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

Patch

diff --git a/drivers/video/fbdev/sis/init301.c b/drivers/video/fbdev/sis/init301.c
index 1ec9c3e0e1d8..02ee752d5000 100644
--- a/drivers/video/fbdev/sis/init301.c
+++ b/drivers/video/fbdev/sis/init301.c
@@ -6486,7 +6486,7 @@  SiS_SetTVSpecial(struct SiS_Private *SiS_Pr, unsigned short ModeNo)
 
   if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
      if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
-        const unsigned char specialtv[] = {
+        static const unsigned char specialtv[] = {
 		0xa7,0x07,0xf2,0x6e,0x17,0x8b,0x73,0x53,
 		0x13,0x40,0x34,0xf4,0x63,0xbb,0xcc,0x7a,
 		0x58,0xe4,0x73,0xda,0x13