Commit ddb6a90d authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

media: dvb-frontends/stv0910: further coding style cleanup

Fixes up all remainders reported by "checkpatch.pl --strict"
Signed-off-by: default avatarDaniel Scheller <d.scheller@gmx.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 448461af
...@@ -71,7 +71,7 @@ static inline u32 muldiv32(u32 a, u32 b, u32 c) ...@@ -71,7 +71,7 @@ static inline u32 muldiv32(u32 a, u32 b, u32 c)
tmp64 = (u64)a * (u64)b; tmp64 = (u64)a * (u64)b;
do_div(tmp64, c); do_div(tmp64, c);
return (u32) tmp64; return (u32)tmp64;
} }
struct stv_base { struct stv_base {
...@@ -79,8 +79,8 @@ struct stv_base { ...@@ -79,8 +79,8 @@ struct stv_base {
u8 adr; u8 adr;
struct i2c_adapter *i2c; struct i2c_adapter *i2c;
struct mutex i2c_lock; struct mutex i2c_lock; /* shared I2C access protect */
struct mutex reg_lock; struct mutex reg_lock; /* shared register write protect */
int count; int count;
u32 extclk; u32 extclk;
...@@ -473,16 +473,16 @@ static int get_cur_symbol_rate(struct stv *state, u32 *p_symbol_rate) ...@@ -473,16 +473,16 @@ static int get_cur_symbol_rate(struct stv *state, u32 *p_symbol_rate)
read_reg(state, RSTV0910_P2_TMGREG1 + state->regoff, &tim_offs1); read_reg(state, RSTV0910_P2_TMGREG1 + state->regoff, &tim_offs1);
read_reg(state, RSTV0910_P2_TMGREG0 + state->regoff, &tim_offs0); read_reg(state, RSTV0910_P2_TMGREG0 + state->regoff, &tim_offs0);
symbol_rate = ((u32) symb_freq3 << 24) | ((u32) symb_freq2 << 16) | symbol_rate = ((u32)symb_freq3 << 24) | ((u32)symb_freq2 << 16) |
((u32) symb_freq1 << 8) | (u32) symb_freq0; ((u32)symb_freq1 << 8) | (u32)symb_freq0;
timing_offset = ((u32) tim_offs2 << 16) | ((u32) tim_offs1 << 8) | timing_offset = ((u32)tim_offs2 << 16) | ((u32)tim_offs1 << 8) |
(u32) tim_offs0; (u32)tim_offs0;
if ((timing_offset & (1<<23)) != 0) if ((timing_offset & (1 << 23)) != 0)
timing_offset |= 0xFF000000; /* Sign extent */ timing_offset |= 0xFF000000; /* Sign extent */
symbol_rate = (u32) (((u64) symbol_rate * state->base->mclk) >> 32); symbol_rate = (u32)(((u64)symbol_rate * state->base->mclk) >> 32);
timing_offset = (s32) (((s64) symbol_rate * (s64) timing_offset) >> 29); timing_offset = (s32)(((s64)symbol_rate * (s64)timing_offset) >> 29);
*p_symbol_rate = symbol_rate + timing_offset; *p_symbol_rate = symbol_rate + timing_offset;
...@@ -498,9 +498,9 @@ static int get_signal_parameters(struct stv *state) ...@@ -498,9 +498,9 @@ static int get_signal_parameters(struct stv *state)
if (state->receive_mode == RCVMODE_DVBS2) { if (state->receive_mode == RCVMODE_DVBS2) {
read_reg(state, RSTV0910_P2_DMDMODCOD + state->regoff, &tmp); read_reg(state, RSTV0910_P2_DMDMODCOD + state->regoff, &tmp);
state->mod_cod = (enum fe_stv0910_mod_cod) ((tmp & 0x7c) >> 2); state->mod_cod = (enum fe_stv0910_mod_cod)((tmp & 0x7c) >> 2);
state->pilots = (tmp & 0x01) != 0; state->pilots = (tmp & 0x01) != 0;
state->fectype = (enum dvbs2_fectype) ((tmp & 0x02) >> 1); state->fectype = (enum dvbs2_fectype)((tmp & 0x02) >> 1);
} else if (state->receive_mode == RCVMODE_DVBS) { } else if (state->receive_mode == RCVMODE_DVBS) {
read_reg(state, RSTV0910_P2_VITCURPUN + state->regoff, &tmp); read_reg(state, RSTV0910_P2_VITCURPUN + state->regoff, &tmp);
...@@ -595,12 +595,12 @@ static s32 table_lookup(struct slookup *table, ...@@ -595,12 +595,12 @@ static s32 table_lookup(struct slookup *table,
s32 reg_diff; s32 reg_diff;
/* Assumes Table[0].RegValue > Table[imax].RegValue */ /* Assumes Table[0].RegValue > Table[imax].RegValue */
if (reg_value >= table[0].reg_value) if (reg_value >= table[0].reg_value) {
value = table[0].value; value = table[0].value;
else if (reg_value <= table[imax].reg_value) } else if (reg_value <= table[imax].reg_value) {
value = table[imax].value; value = table[imax].value;
else { } else {
while (imax-imin > 1) { while ((imax - imin) > 1) {
i = (imax + imin) / 2; i = (imax + imin) / 2;
if ((table[imin].reg_value >= reg_value) && if ((table[imin].reg_value >= reg_value) &&
(reg_value >= table[i].reg_value)) (reg_value >= table[i].reg_value))
...@@ -649,7 +649,7 @@ static int get_signal_to_noise(struct stv *state, s32 *signal_to_noise) ...@@ -649,7 +649,7 @@ static int get_signal_to_noise(struct stv *state, s32 *signal_to_noise)
n_lookup = ARRAY_SIZE(s1_sn_lookup); n_lookup = ARRAY_SIZE(s1_sn_lookup);
lookup = s1_sn_lookup; lookup = s1_sn_lookup;
} }
data = (((u16)data1) << 8) | (u16) data0; data = (((u16)data1) << 8) | (u16)data0;
*signal_to_noise = table_lookup(lookup, n_lookup, data); *signal_to_noise = table_lookup(lookup, n_lookup, data);
return 0; return 0;
} }
...@@ -669,8 +669,8 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator, ...@@ -669,8 +669,8 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator,
if ((regs[0] & 0x80) == 0) { if ((regs[0] & 0x80) == 0) {
state->last_berdenominator = 1 << ((state->berscale * 2) + state->last_berdenominator = 1 << ((state->berscale * 2) +
10 + 3); 10 + 3);
state->last_bernumerator = ((u32) (regs[0] & 0x7F) << 16) | state->last_bernumerator = ((u32)(regs[0] & 0x7F) << 16) |
((u32) regs[1] << 8) | regs[2]; ((u32)regs[1] << 8) | regs[2];
if (state->last_bernumerator < 256 && state->berscale < 6) { if (state->last_bernumerator < 256 && state->berscale < 6) {
state->berscale += 1; state->berscale += 1;
status = write_reg(state, RSTV0910_P2_ERRCTRL1 + status = write_reg(state, RSTV0910_P2_ERRCTRL1 +
...@@ -742,11 +742,11 @@ static int get_bit_error_rate_s2(struct stv *state, u32 *bernumerator, ...@@ -742,11 +742,11 @@ static int get_bit_error_rate_s2(struct stv *state, u32 *bernumerator,
if ((regs[0] & 0x80) == 0) { if ((regs[0] & 0x80) == 0) {
state->last_berdenominator = state->last_berdenominator =
dvbs2_nbch((enum dvbs2_mod_cod) state->mod_cod, dvbs2_nbch((enum dvbs2_mod_cod)state->mod_cod,
state->fectype) << state->fectype) <<
(state->berscale * 2); (state->berscale * 2);
state->last_bernumerator = (((u32) regs[0] & 0x7F) << 16) | state->last_bernumerator = (((u32)regs[0] & 0x7F) << 16) |
((u32) regs[1] << 8) | regs[2]; ((u32)regs[1] << 8) | regs[2];
if (state->last_bernumerator < 256 && state->berscale < 6) { if (state->last_bernumerator < 256 && state->berscale < 6) {
state->berscale += 1; state->berscale += 1;
write_reg(state, RSTV0910_P2_ERRCTRL1 + state->regoff, write_reg(state, RSTV0910_P2_ERRCTRL1 + state->regoff,
...@@ -1211,7 +1211,6 @@ static int probe(struct stv *state) ...@@ -1211,7 +1211,6 @@ static int probe(struct stv *state)
return 0; return 0;
} }
static int gate_ctrl(struct dvb_frontend *fe, int enable) static int gate_ctrl(struct dvb_frontend *fe, int enable)
{ {
struct stv *state = fe->demodulator_priv; struct stv *state = fe->demodulator_priv;
...@@ -1275,7 +1274,7 @@ static int manage_matype_info(struct stv *state) ...@@ -1275,7 +1274,7 @@ static int manage_matype_info(struct stv *state)
read_regs(state, RSTV0910_P2_MATSTR1 + state->regoff, read_regs(state, RSTV0910_P2_MATSTR1 + state->regoff,
bbheader, 2); bbheader, 2);
state->feroll_off = state->feroll_off =
(enum fe_stv0910_roll_off) (bbheader[0] & 0x03); (enum fe_stv0910_roll_off)(bbheader[0] & 0x03);
state->is_vcm = (bbheader[0] & 0x10) == 0; state->is_vcm = (bbheader[0] & 0x10) == 0;
state->is_standard_broadcast = (bbheader[0] & 0xFC) == 0xF0; state->is_standard_broadcast = (bbheader[0] & 0xFC) == 0xF0;
} else if (state->receive_mode == RCVMODE_DVBS) { } else if (state->receive_mode == RCVMODE_DVBS) {
...@@ -1295,8 +1294,9 @@ static int read_snr(struct dvb_frontend *fe) ...@@ -1295,8 +1294,9 @@ static int read_snr(struct dvb_frontend *fe)
if (!get_signal_to_noise(state, &snrval)) { if (!get_signal_to_noise(state, &snrval)) {
p->cnr.stat[0].scale = FE_SCALE_DECIBEL; p->cnr.stat[0].scale = FE_SCALE_DECIBEL;
p->cnr.stat[0].uvalue = 100 * snrval; /* fix scale */ p->cnr.stat[0].uvalue = 100 * snrval; /* fix scale */
} else } else {
p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
}
return 0; return 0;
} }
...@@ -1328,12 +1328,12 @@ static void read_signal_strength(struct dvb_frontend *fe) ...@@ -1328,12 +1328,12 @@ static void read_signal_strength(struct dvb_frontend *fe)
read_regs(state, RSTV0910_P2_AGCIQIN1 + state->regoff, reg, 2); read_regs(state, RSTV0910_P2_AGCIQIN1 + state->regoff, reg, 2);
agc = (((u32) reg[0]) << 8) | reg[1]; agc = (((u32)reg[0]) << 8) | reg[1];
for (i = 0; i < 5; i += 1) { for (i = 0; i < 5; i += 1) {
read_regs(state, RSTV0910_P2_POWERI + state->regoff, reg, 2); read_regs(state, RSTV0910_P2_POWERI + state->regoff, reg, 2);
power += (u32) reg[0] * (u32) reg[0] power += (u32)reg[0] * (u32)reg[0]
+ (u32) reg[1] * (u32) reg[1]; + (u32)reg[1] * (u32)reg[1];
usleep_range(3000, 4000); usleep_range(3000, 4000);
} }
power /= 5; power /= 5;
...@@ -1490,9 +1490,9 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status) ...@@ -1490,9 +1490,9 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
/* read ber */ /* read ber */
if (*status & FE_HAS_VITERBI) if (*status & FE_HAS_VITERBI) {
read_ber(fe); read_ber(fe);
else { } else {
p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
} }
...@@ -1584,7 +1584,6 @@ static int tune(struct dvb_frontend *fe, bool re_tune, ...@@ -1584,7 +1584,6 @@ static int tune(struct dvb_frontend *fe, bool re_tune,
return 0; return 0;
} }
static int get_algo(struct dvb_frontend *fe) static int get_algo(struct dvb_frontend *fe)
{ {
return DVBFE_ALGO_HW; return DVBFE_ALGO_HW;
...@@ -1728,7 +1727,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, ...@@ -1728,7 +1727,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
struct stv *state; struct stv *state;
struct stv_base *base; struct stv_base *base;
state = kzalloc(sizeof(struct stv), GFP_KERNEL); state = kzalloc(sizeof(*state), GFP_KERNEL);
if (!state) if (!state)
return NULL; return NULL;
...@@ -1749,7 +1748,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, ...@@ -1749,7 +1748,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
base->count++; base->count++;
state->base = base; state->base = base;
} else { } else {
base = kzalloc(sizeof(struct stv_base), GFP_KERNEL); base = kzalloc(sizeof(*base), GFP_KERNEL);
if (!base) if (!base)
goto fail; goto fail;
base->i2c = i2c; base->i2c = i2c;
......
...@@ -14,7 +14,7 @@ struct stv0910_cfg { ...@@ -14,7 +14,7 @@ struct stv0910_cfg {
#if IS_REACHABLE(CONFIG_DVB_STV0910) #if IS_REACHABLE(CONFIG_DVB_STV0910)
extern struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
struct stv0910_cfg *cfg, int nr); struct stv0910_cfg *cfg, int nr);
#else #else
......
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