Commit ba0c8e6e authored by Colin Ian King's avatar Colin Ian King Committed by Mauro Carvalho Chehab

media: em28xx: make various 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 767 bytes.

Before:
   text	   data	    bss	    dec	    hex	filename
  41567	  15088	    192	  56847	   de0f	em28xx/em28xx-dvb.o

After:
   text	   data	    bss	    dec	    hex	filename
  39872	  16016	    192	  56080	   db10	em28xx/em28xx-dvb.o

(gcc version 9.2.1, amd64)
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 5914ecf4
...@@ -471,13 +471,13 @@ static void hauppauge_hvr930c_init(struct em28xx *dev) ...@@ -471,13 +471,13 @@ static void hauppauge_hvr930c_init(struct em28xx *dev)
{ {
int i; int i;
struct em28xx_reg_seq hauppauge_hvr930c_init[] = { static const struct em28xx_reg_seq hauppauge_hvr930c_init[] = {
{EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0x65}, {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0x65},
{EM2874_R80_GPIO_P0_CTRL, 0xfb, 0xff, 0x32}, {EM2874_R80_GPIO_P0_CTRL, 0xfb, 0xff, 0x32},
{EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0xb8}, {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 0xb8},
{ -1, -1, -1, -1}, { -1, -1, -1, -1},
}; };
struct em28xx_reg_seq hauppauge_hvr930c_end[] = { static const struct em28xx_reg_seq hauppauge_hvr930c_end[] = {
{EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x01}, {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x01},
{EM2874_R80_GPIO_P0_CTRL, 0xaf, 0xff, 0x65}, {EM2874_R80_GPIO_P0_CTRL, 0xaf, 0xff, 0x65},
{EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x76}, {EM2874_R80_GPIO_P0_CTRL, 0xef, 0xff, 0x76},
...@@ -493,7 +493,7 @@ static void hauppauge_hvr930c_init(struct em28xx *dev) ...@@ -493,7 +493,7 @@ static void hauppauge_hvr930c_init(struct em28xx *dev)
{ -1, -1, -1, -1}, { -1, -1, -1, -1},
}; };
struct { static const struct {
unsigned char r[4]; unsigned char r[4];
int len; int len;
} regs[] = { } regs[] = {
...@@ -537,20 +537,20 @@ static void hauppauge_hvr930c_init(struct em28xx *dev) ...@@ -537,20 +537,20 @@ static void hauppauge_hvr930c_init(struct em28xx *dev)
static void terratec_h5_init(struct em28xx *dev) static void terratec_h5_init(struct em28xx *dev)
{ {
int i; int i;
struct em28xx_reg_seq terratec_h5_init[] = { static const struct em28xx_reg_seq terratec_h5_init[] = {
{EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10}, {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xf2, 0xff, 50}, {EM2874_R80_GPIO_P0_CTRL, 0xf2, 0xff, 50},
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
{ -1, -1, -1, -1}, { -1, -1, -1, -1},
}; };
struct em28xx_reg_seq terratec_h5_end[] = { static const struct em28xx_reg_seq terratec_h5_end[] = {
{EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50}, {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50},
{EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
{ -1, -1, -1, -1}, { -1, -1, -1, -1},
}; };
struct { static const struct {
unsigned char r[4]; unsigned char r[4];
int len; int len;
} regs[] = { } regs[] = {
...@@ -594,14 +594,14 @@ static void terratec_htc_stick_init(struct em28xx *dev) ...@@ -594,14 +594,14 @@ static void terratec_htc_stick_init(struct em28xx *dev)
* 0xe6: unknown (does not affect DVB-T). * 0xe6: unknown (does not affect DVB-T).
* 0xb6: unknown (does not affect DVB-T). * 0xb6: unknown (does not affect DVB-T).
*/ */
struct em28xx_reg_seq terratec_htc_stick_init[] = { static const struct em28xx_reg_seq terratec_htc_stick_init[] = {
{EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10}, {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 50}, {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 50},
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 100},
{ -1, -1, -1, -1}, { -1, -1, -1, -1},
}; };
struct em28xx_reg_seq terratec_htc_stick_end[] = { static const struct em28xx_reg_seq terratec_htc_stick_end[] = {
{EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 50}, {EM2874_R80_GPIO_P0_CTRL, 0xf6, 0xff, 50},
{ -1, -1, -1, -1}, { -1, -1, -1, -1},
...@@ -611,7 +611,7 @@ static void terratec_htc_stick_init(struct em28xx *dev) ...@@ -611,7 +611,7 @@ static void terratec_htc_stick_init(struct em28xx *dev)
* Init the analog decoder (not yet supported), but * Init the analog decoder (not yet supported), but
* it's probably still a good idea. * it's probably still a good idea.
*/ */
struct { static const struct {
unsigned char r[4]; unsigned char r[4];
int len; int len;
} regs[] = { } regs[] = {
...@@ -642,14 +642,14 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev) ...@@ -642,14 +642,14 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev)
{ {
int i; int i;
struct em28xx_reg_seq terratec_htc_usb_xs_init[] = { static const struct em28xx_reg_seq terratec_htc_usb_xs_init[] = {
{EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10}, {EM2820_R08_GPIO_CTRL, 0xff, 0xff, 10},
{EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 50}, {EM2874_R80_GPIO_P0_CTRL, 0xb2, 0xff, 50},
{EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xb6, 0xff, 100},
{ -1, -1, -1, -1}, { -1, -1, -1, -1},
}; };
struct em28xx_reg_seq terratec_htc_usb_xs_end[] = { static const struct em28xx_reg_seq terratec_htc_usb_xs_end[] = {
{EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 100},
{EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50}, {EM2874_R80_GPIO_P0_CTRL, 0xa6, 0xff, 50},
{EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100}, {EM2874_R80_GPIO_P0_CTRL, 0xe6, 0xff, 100},
...@@ -660,7 +660,7 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev) ...@@ -660,7 +660,7 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev)
* Init the analog decoder (not yet supported), but * Init the analog decoder (not yet supported), but
* it's probably still a good idea. * it's probably still a good idea.
*/ */
struct { static const struct {
unsigned char r[4]; unsigned char r[4];
int len; int len;
} regs[] = { } regs[] = {
...@@ -704,7 +704,7 @@ static void pctv_520e_init(struct em28xx *dev) ...@@ -704,7 +704,7 @@ static void pctv_520e_init(struct em28xx *dev)
* digital demodulator and tuner are routed via AVF4910B. * digital demodulator and tuner are routed via AVF4910B.
*/ */
int i; int i;
struct { static const struct {
unsigned char r[4]; unsigned char r[4];
int len; int len;
} regs[] = { } regs[] = {
...@@ -800,7 +800,7 @@ static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) ...@@ -800,7 +800,7 @@ static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe)
static void px_bcud_init(struct em28xx *dev) static void px_bcud_init(struct em28xx *dev)
{ {
int i; int i;
struct { static const struct {
unsigned char r[4]; unsigned char r[4];
int len; int len;
} regs1[] = { } regs1[] = {
...@@ -818,7 +818,7 @@ static void px_bcud_init(struct em28xx *dev) ...@@ -818,7 +818,7 @@ static void px_bcud_init(struct em28xx *dev)
{{ 0x85, 0x7a }, 2}, {{ 0x85, 0x7a }, 2},
{{ 0x87, 0x04 }, 2}, {{ 0x87, 0x04 }, 2},
}; };
static struct em28xx_reg_seq gpio[] = { static const struct em28xx_reg_seq gpio[] = {
{EM28XX_R06_I2C_CLK, 0x40, 0xff, 300}, {EM28XX_R06_I2C_CLK, 0x40, 0xff, 300},
{EM2874_R80_GPIO_P0_CTRL, 0xfd, 0xff, 60}, {EM2874_R80_GPIO_P0_CTRL, 0xfd, 0xff, 60},
{EM28XX_R15_RGAIN, 0x20, 0xff, 0}, {EM28XX_R15_RGAIN, 0x20, 0xff, 0},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment