tmp64 = (u64)a * (u64)b;
do_div(tmp64, c);
- return (u32) tmp64;
+ return (u32)tmp64;
}
static int i2c_read(struct i2c_adapter *adap,
index = 6;
if (index > 50)
index = 50;
- if ((state->reg[0x08] & ~0xFC) == ((index-6) << 2))
+ if ((state->reg[0x08] & ~0xFC) == ((index - 6) << 2))
return 0;
- state->reg[0x08] = (state->reg[0x08] & ~0xFC) | ((index-6) << 2);
+ state->reg[0x08] = (state->reg[0x08] & ~0xFC) | ((index - 6) << 2);
state->reg[0x09] = (state->reg[0x09] & ~0x0C) | 0x08;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
int i;
/* Assumes Table[0].RegValue < Table[imax].RegValue */
- if (reg_value <= table[0].reg_value)
+ if (reg_value <= table[0].reg_value) {
gain = table[0].value;
- else if (reg_value >= table[imax].reg_value)
+ } else if (reg_value >= table[imax].reg_value) {
gain = table[imax].value;
- else {
- while (imax-imin > 1) {
+ } else {
+ while ((imax - imin) > 1) {
i = (imax + imin) / 2;
if ((table[imin].reg_value <= reg_value) &&
(reg_value <= table[i].reg_value))
reg_diff = table[imax].reg_value - table[imin].reg_value;
gain = table[imin].value;
if (reg_diff != 0)
- gain += ((s32) (reg_value - table[imin].reg_value) *
+ gain += ((s32)(reg_value - table[imin].reg_value) *
(s32)(table[imax].value
- - table[imin].value))/(reg_diff);
+ - table[imin].value)) / reg_diff;
}
return gain;
}
if ((state->reg[0x02] & 0x80) == 0)
/* NF */
gain = table_lookup(lnagain_nf_lookup,
- ARRAY_SIZE(lnagain_nf_lookup), reg & 0x1F);
+ ARRAY_SIZE(lnagain_nf_lookup),
+ reg & 0x1F);
else
/* IIP3 */
gain = table_lookup(lnagain_iip3_lookup,
- ARRAY_SIZE(lnagain_iip3_lookup), reg & 0x1F);
+ ARRAY_SIZE(lnagain_iip3_lookup),
+ reg & 0x1F);
gain += table_lookup(gain_rfagc_lookup,
- ARRAY_SIZE(gain_rfagc_lookup), rfagc);
+ ARRAY_SIZE(gain_rfagc_lookup), rfagc);
+
gain -= 2400;
} else {
/* Channel Mode */
if ((state->reg[0x02] & 0x80) == 0) {
/* NF */
- gain = table_lookup(gain_channel_agc_nf_lookup,
+ gain = table_lookup(
+ gain_channel_agc_nf_lookup,
ARRAY_SIZE(gain_channel_agc_nf_lookup), rfagc);
+
gain += 600;
} else {
/* IIP3 */
- gain = table_lookup(gain_channel_agc_iip3_lookup,
+ gain = table_lookup(
+ gain_channel_agc_iip3_lookup,
ARRAY_SIZE(gain_channel_agc_iip3_lookup),
- rfagc);
+ rfagc);
}
}
struct stv *state;
int stat;
- state = kzalloc(sizeof(struct stv), GFP_KERNEL);
+ state = kzalloc(sizeof(*state), GFP_KERNEL);
if (!state)
return NULL;
state->adr = adr;
#if IS_REACHABLE(CONFIG_DVB_STV6111)
-extern struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c, u8 adr);
+struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
+ struct i2c_adapter *i2c, u8 adr);
#else
static inline struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c, u8 adr)
+ struct i2c_adapter *i2c,
+ u8 adr)
{
pr_warn("%s: Driver disabled by Kconfig\n", __func__);
return NULL;