diff options
author | Daniel Scheller <d.scheller@gmx.net> | 2017-12-26 18:37:56 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-01-03 04:45:45 -0500 |
commit | 4b596bd70a396dfeb55f38b6bd1c21b8e77ebe77 (patch) | |
tree | ee82c28e583c50ce89f4a1d87f87836c9ea04535 | |
parent | 3bdf481e39ff1d36c1f2e1b3862db2ac329b12cd (diff) |
media: dvb-frontends/stv0910: deduplicate writes in enable_puncture_rate()
For all code rates, the same write is performed, only with a differing
value. Clean this up by putting that value into a variable instead and
perform the write at the end with that value.
Picked up from the dddvb upstream.
Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/dvb-frontends/stv0910.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 946e55c74afa..9f38ebeec853 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -908,27 +908,31 @@ static int init_search_param(struct stv *state) static int enable_puncture_rate(struct stv *state, enum fe_code_rate rate) { + u8 val; + switch (rate) { case FEC_1_2: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x01); + val = 0x01; + break; case FEC_2_3: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x02); + val = 0x02; + break; case FEC_3_4: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x04); + val = 0x04; + break; case FEC_5_6: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x08); + val = 0x08; + break; case FEC_7_8: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x20); + val = 0x20; + break; case FEC_NONE: default: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x2f); + val = 0x2f; + break; } + + return write_reg(state, RSTV0910_P2_PRVIT + state->regoff, val); } static int set_vth_default(struct stv *state) |