Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fbdev: matrox: make array wtst_xlat static const, makes object smaller

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

Before:
text data bss dec hex filename
14347 840 0 15187 3b53 fbdev/matrox/matroxfb_misc.o

After:
text data bss dec hex filename
14162 936 0 15098 3afa fbdev/matrox/matroxfb_misc.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
[b.zolnierkie: use u8 while at it (suggested by Ville Syrjälä)]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906181114.31414-1-colin.king@canonical.com

authored by

Colin Ian King and committed by
Bartlomiej Zolnierkiewicz
776b0aa9 3149299e

+4 -1
+4 -1
drivers/video/fbdev/matrox/matroxfb_misc.c
··· 673 673 if (bd->pins[115] & 4) { 674 674 minfo->values.reg.mctlwtst_core = minfo->values.reg.mctlwtst; 675 675 } else { 676 - u_int32_t wtst_xlat[] = { 0, 1, 5, 6, 7, 5, 2, 3 }; 676 + static const u8 wtst_xlat[] = { 677 + 0, 1, 5, 6, 7, 5, 2, 3 678 + }; 679 + 677 680 minfo->values.reg.mctlwtst_core = (minfo->values.reg.mctlwtst & ~7) | 678 681 wtst_xlat[minfo->values.reg.mctlwtst & 7]; 679 682 }