Skip to content

Commit

Permalink
V4L/DVB: [STV090x] Code simplification
Browse files Browse the repository at this point in the history
 - Remove a redundant exported gate control function

Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Manu Abraham authored and Mauro Carvalho Chehab committed May 18, 2010
1 parent 20d2c56 commit 19c4ee5
Showing 1 changed file with 27 additions and 30 deletions.
57 changes: 27 additions & 30 deletions drivers/media/dvb/frontends/stv090x.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,8 @@ static int stv090x_write_reg(struct stv090x_state *state, unsigned int reg, u8 d
return stv090x_write_regs(state, reg, &data, 1);
}

static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable)
{
struct stv090x_state *state = fe->demodulator_priv;
u32 reg;

if (enable)
Expand Down Expand Up @@ -1778,7 +1777,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
freq -= cur_step * car_step;

/* Setup tuner */
if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_set_frequency) {
Expand All @@ -1791,12 +1790,12 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
goto err_gateoff;
}

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

msleep(50);

if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_get_status) {
Expand All @@ -1809,7 +1808,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
else
dprintk(FE_DEBUG, 1, "Tuner unlocked");

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

}
Expand All @@ -1822,7 +1821,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
return srate_coarse;

err_gateoff:
stv090x_i2c_gate_ctrl(fe, 0);
stv090x_i2c_gate_ctrl(state, 0);
err:
dprintk(FE_ERROR, 1, "I/O error");
return -1;
Expand Down Expand Up @@ -2167,7 +2166,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
freq -= cur_step * car_step;

/* Setup tuner */
if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_set_frequency) {
Expand All @@ -2180,12 +2179,12 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
goto err_gateoff;
}

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

msleep(50);

if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_get_status) {
Expand All @@ -2198,7 +2197,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
else
dprintk(FE_DEBUG, 1, "Tuner unlocked");

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1c);
Expand All @@ -2222,7 +2221,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
return lock;

err_gateoff:
stv090x_i2c_gate_ctrl(fe, 0);
stv090x_i2c_gate_ctrl(state, 0);
err:
dprintk(FE_ERROR, 1, "I/O error");
return -1;
Expand Down Expand Up @@ -2591,15 +2590,15 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
}
state->delsys = stv090x_get_std(state);

if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_get_frequency) {
if (state->config->tuner_get_frequency(fe, &state->frequency) < 0)
goto err_gateoff;
}

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

offst_freq = stv090x_get_car_freq(state, state->internal->mclk) / 1000;
Expand All @@ -2619,15 +2618,15 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st

if ((state->algo == STV090x_BLIND_SEARCH) || (state->srate < 10000000)) {

if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_get_frequency) {
if (state->config->tuner_get_frequency(fe, &state->frequency) < 0)
goto err_gateoff;
}

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

if (abs(offst_freq) <= ((state->search_range / 2000) + 500))
Expand All @@ -2646,7 +2645,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
return STV090x_OUTOFRANGE;

err_gateoff:
stv090x_i2c_gate_ctrl(fe, 0);
stv090x_i2c_gate_ctrl(state, 0);
err:
dprintk(FE_ERROR, 1, "I/O error");
return -1;
Expand Down Expand Up @@ -3000,15 +2999,15 @@ static int stv090x_optimize_track(struct stv090x_state *state)

if (state->algo != STV090x_WARM_SEARCH) {

if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_set_bandwidth) {
if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
goto err_gateoff;
}

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

}
Expand Down Expand Up @@ -3059,7 +3058,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
return 0;

err_gateoff:
stv090x_i2c_gate_ctrl(fe, 0);
stv090x_i2c_gate_ctrl(state, 0);
err:
dprintk(FE_ERROR, 1, "I/O error");
return -1;
Expand Down Expand Up @@ -3235,7 +3234,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
}

/* Setup tuner */
if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (state->config->tuner_set_bbgain) {
Expand All @@ -3256,17 +3255,17 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
goto err_gateoff;
}

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

msleep(50);

if (state->config->tuner_get_status) {
if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;
if (state->config->tuner_get_status(fe, &reg) < 0)
goto err_gateoff;
if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

if (reg)
Expand Down Expand Up @@ -3400,7 +3399,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
return signal_state;

err_gateoff:
stv090x_i2c_gate_ctrl(fe, 0);
stv090x_i2c_gate_ctrl(state, 0);
err:
dprintk(FE_ERROR, 1, "I/O error");
return -1;
Expand Down Expand Up @@ -4336,7 +4335,7 @@ static int stv090x_init(struct dvb_frontend *fe)
if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0)
goto err;

if (stv090x_i2c_gate_ctrl(fe, 1) < 0)
if (stv090x_i2c_gate_ctrl(state, 1) < 0)
goto err;

if (config->tuner_set_mode) {
Expand All @@ -4349,7 +4348,7 @@ static int stv090x_init(struct dvb_frontend *fe)
goto err_gateoff;
}

if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
if (stv090x_i2c_gate_ctrl(state, 0) < 0)
goto err;

if (stv090x_set_tspath(state) < 0)
Expand All @@ -4358,7 +4357,7 @@ static int stv090x_init(struct dvb_frontend *fe)
return 0;

err_gateoff:
stv090x_i2c_gate_ctrl(fe, 0);
stv090x_i2c_gate_ctrl(state, 0);
err:
dprintk(FE_ERROR, 1, "I/O error");
return -1;
Expand Down Expand Up @@ -4503,8 +4502,6 @@ static struct dvb_frontend_ops stv090x_ops = {
.sleep = stv090x_sleep,
.get_frontend_algo = stv090x_frontend_algo,

.i2c_gate_ctrl = stv090x_i2c_gate_ctrl,

.diseqc_send_master_cmd = stv090x_send_diseqc_msg,
.diseqc_send_burst = stv090x_send_diseqc_burst,
.diseqc_recv_slave_reply = stv090x_recv_slave_reply,
Expand Down

0 comments on commit 19c4ee5

Please sign in to comment.