mirror of https://gitee.com/openkylin/linux.git
staging: fbtft: make several arrays static const, makes object smaller
Don't populate the arrays on the stack but instead make them static const. Makes the object code smaller by 1329 bytes. Before: text data bss dec hex filename 5581 1488 64 7133 1bdd drivers/staging/fbtft/fb_hx8340bn.o 5444 1264 0 6708 1a34 drivers/staging/fbtft/fb_hx8347d.o 3581 1360 0 4941 134d drivers/staging/fbtft/fb_ili9163.o 7154 1552 0 8706 2202 drivers/staging/fbtft/fb_ili9320.o 7478 2544 0 10022 2726 drivers/staging/fbtft/fb_ili9325.o 6327 1424 0 7751 1e47 drivers/staging/fbtft/fb_s6d1121.o 6498 1776 0 8274 2052 drivers/staging/fbtft/fb_ssd1289.o After: text data bss dec hex filename 5376 1584 64 7024 1b70 drivers/staging/fbtft/fb_hx8340bn.o 5276 1328 0 6604 19cc drivers/staging/fbtft/fb_hx8347d.o 3581 1360 0 4941 134d drivers/staging/fbtft/fb_ili9163.o 6905 1616 0 8521 2149 drivers/staging/fbtft/fb_ili9320.o 7229 2608 0 9837 266d drivers/staging/fbtft/fb_ili9325.o 6030 1488 0 7518 1d5e drivers/staging/fbtft/fb_s6d1121.o 6249 1872 0 8121 1fb9 drivers/staging/fbtft/fb_ssd1289.o (gcc version 9.2.1, amd64) Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20190906153052.31846-1-colin.king@canonical.com
This commit is contained in:
parent
dcc7b1f3ae
commit
64e9c200a0
|
@ -151,7 +151,7 @@ static int set_var(struct fbtft_par *par)
|
|||
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
|
||||
static int set_gamma(struct fbtft_par *par, u32 *curves)
|
||||
{
|
||||
unsigned long mask[] = {
|
||||
static const unsigned long mask[] = {
|
||||
0x0f, 0x0f, 0x1f, 0x0f, 0x0f, 0x0f, 0x1f, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x03, 0x03, 0x0f, 0x0f, 0x1f, 0x0f, 0x0f,
|
||||
0x0f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00,
|
||||
|
|
|
@ -95,7 +95,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
|
|||
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
|
||||
static int set_gamma(struct fbtft_par *par, u32 *curves)
|
||||
{
|
||||
unsigned long mask[] = {
|
||||
static const unsigned long mask[] = {
|
||||
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x7f, 0x7f, 0x1f, 0x1f,
|
||||
0x1f, 0x1f, 0x1f, 0x0f,
|
||||
};
|
||||
|
|
|
@ -195,7 +195,7 @@ static int set_var(struct fbtft_par *par)
|
|||
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
|
||||
static int gamma_adj(struct fbtft_par *par, u32 *curves)
|
||||
{
|
||||
unsigned long mask[] = {
|
||||
static const unsigned long mask[] = {
|
||||
0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
|
||||
0x1f, 0x3f, 0x0f, 0x0f, 0x7f, 0x1f,
|
||||
0x3F, 0x3F, 0x3F, 0x3F, 0x3F};
|
||||
|
|
|
@ -214,7 +214,7 @@ static int set_var(struct fbtft_par *par)
|
|||
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
|
||||
static int set_gamma(struct fbtft_par *par, u32 *curves)
|
||||
{
|
||||
unsigned long mask[] = {
|
||||
static const unsigned long mask[] = {
|
||||
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
};
|
||||
|
|
|
@ -208,7 +208,7 @@ static int set_var(struct fbtft_par *par)
|
|||
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
|
||||
static int set_gamma(struct fbtft_par *par, u32 *curves)
|
||||
{
|
||||
unsigned long mask[] = {
|
||||
static const unsigned long mask[] = {
|
||||
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
};
|
||||
|
|
|
@ -123,7 +123,7 @@ static int set_var(struct fbtft_par *par)
|
|||
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
|
||||
static int set_gamma(struct fbtft_par *par, u32 *curves)
|
||||
{
|
||||
unsigned long mask[] = {
|
||||
static const unsigned long mask[] = {
|
||||
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
|
||||
0x3f, 0x3f, 0x1f, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
|
||||
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0x1f,
|
||||
|
|
|
@ -129,7 +129,7 @@ static int set_var(struct fbtft_par *par)
|
|||
#define CURVE(num, idx) curves[(num) * par->gamma.num_values + (idx)]
|
||||
static int set_gamma(struct fbtft_par *par, u32 *curves)
|
||||
{
|
||||
unsigned long mask[] = {
|
||||
static const unsigned long mask[] = {
|
||||
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x1f, 0x1f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue