From 1334a7dc5fad6f41ee421ce06f4cdf2b25d2d6e4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 9 Mar 2018 10:53:32 -0500 Subject: [PATCH] media: lgdt330x: constify several register init arrays There are several register init arrays there that can be constified. The change reduced a little bit the amount of initialized data: text data bss dec hex filename 6372 360 4 6736 1a50 old/drivers/media/dvb-frontends/lgdt330x.o 6500 264 4 6768 1a70 new/drivers/media/dvb-frontends/lgdt330x.o Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/lgdt330x.c | 43 ++++++++++++++-------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/drivers/media/dvb-frontends/lgdt330x.c b/drivers/media/dvb-frontends/lgdt330x.c index e93ffe8891e5..c7355282bb3e 100644 --- a/drivers/media/dvb-frontends/lgdt330x.c +++ b/drivers/media/dvb-frontends/lgdt330x.c @@ -186,19 +186,14 @@ static int lgdt330x_sw_reset(struct lgdt330x_state *state) static int lgdt330x_init(struct dvb_frontend *fe) { - /* - * Hardware reset is done using gpio[0] of cx23880x chip. - * I'd like to do it here, but don't know how to find chip address. - * cx88-cards.c arranges for the reset bit to be inactive (high). - * Maybe there needs to be a callable function in cx88-core or - * the caller of this function needs to do it. - */ - + struct lgdt330x_state *state = fe->demodulator_priv; + char *chip_name; + int err; /* * Array of byte pairs * to initialize each different chip */ - static u8 lgdt3302_init_data[] = { + static const u8 lgdt3302_init_data[] = { /* Use 50MHz param values from spec sheet since xtal is 50 */ /* * Change the value of NCOCTFV[25:0] of carrier @@ -243,24 +238,25 @@ static int lgdt330x_init(struct dvb_frontend *fe) AGC_LOOP_BANDWIDTH0, 0x08, AGC_LOOP_BANDWIDTH1, 0x9a }; - - static u8 lgdt3303_init_data[] = { + static const u8 lgdt3303_init_data[] = { 0x4c, 0x14 }; - - static u8 flip_1_lgdt3303_init_data[] = { + static const u8 flip_1_lgdt3303_init_data[] = { 0x4c, 0x14, 0x87, 0xf3 }; - - static u8 flip_2_lgdt3303_init_data[] = { + static const u8 flip_2_lgdt3303_init_data[] = { 0x4c, 0x14, 0x87, 0xda }; - struct lgdt330x_state *state = fe->demodulator_priv; - char *chip_name; - int err; + /* + * Hardware reset is done using gpio[0] of cx23880x chip. + * I'd like to do it here, but don't know how to find chip address. + * cx88-cards.c arranges for the reset bit to be inactive (high). + * Maybe there needs to be a callable function in cx88-core or + * the caller of this function needs to do it. + */ switch (state->config.demod_chip) { case LGDT3302: @@ -337,11 +333,12 @@ static int lgdt330x_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) static int lgdt330x_set_parameters(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = &fe->dtv_property_cache; + struct lgdt330x_state *state = fe->demodulator_priv; /* * Array of byte pairs * to initialize 8VSB for lgdt3303 chip 50 MHz IF */ - static u8 lgdt3303_8vsb_44_data[] = { + static const u8 lgdt3303_8vsb_44_data[] = { 0x04, 0x00, 0x0d, 0x40, 0x0e, 0x87, @@ -349,12 +346,11 @@ static int lgdt330x_set_parameters(struct dvb_frontend *fe) 0x10, 0x01, 0x47, 0x8b }; - /* * Array of byte pairs * to initialize QAM for lgdt3303 chip */ - static u8 lgdt3303_qam_data[] = { + static const u8 lgdt3303_qam_data[] = { 0x04, 0x00, 0x0d, 0x00, 0x0e, 0x00, @@ -367,10 +363,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend *fe) 0x49, 0x08, 0x4a, 0x9b }; - - struct lgdt330x_state *state = fe->demodulator_priv; - - static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; + u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 }; int err = 0; /* Change only if we are actually changing the modulation */ -- 2.11.0