diff options
author | Manu Abraham <abraham.manu@gmail.com> | 2010-01-22 15:19:49 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-17 23:46:47 -0400 |
commit | 19c4ee58325ac7c9d9595153fabb5d885dfe931e (patch) | |
tree | b919ac4d09283e66ce5431c8fe3230f2ae17ff80 /drivers/media/dvb/frontends/stv090x.c | |
parent | 20d2c56de8b3c462c40ef2eff42ff722905e28cf (diff) |
V4L/DVB: [STV090x] Code simplification
- Remove a redundant exported gate control function
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends/stv090x.c')
-rw-r--r-- | drivers/media/dvb/frontends/stv090x.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 96972804f4ad..0af17083511c 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c | |||
@@ -754,9 +754,8 @@ static int stv090x_write_reg(struct stv090x_state *state, unsigned int reg, u8 d | |||
754 | return stv090x_write_regs(state, reg, &data, 1); | 754 | return stv090x_write_regs(state, reg, &data, 1); |
755 | } | 755 | } |
756 | 756 | ||
757 | static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | 757 | static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable) |
758 | { | 758 | { |
759 | struct stv090x_state *state = fe->demodulator_priv; | ||
760 | u32 reg; | 759 | u32 reg; |
761 | 760 | ||
762 | if (enable) | 761 | if (enable) |
@@ -1778,7 +1777,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) | |||
1778 | freq -= cur_step * car_step; | 1777 | freq -= cur_step * car_step; |
1779 | 1778 | ||
1780 | /* Setup tuner */ | 1779 | /* Setup tuner */ |
1781 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 1780 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
1782 | goto err; | 1781 | goto err; |
1783 | 1782 | ||
1784 | if (state->config->tuner_set_frequency) { | 1783 | if (state->config->tuner_set_frequency) { |
@@ -1791,12 +1790,12 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) | |||
1791 | goto err_gateoff; | 1790 | goto err_gateoff; |
1792 | } | 1791 | } |
1793 | 1792 | ||
1794 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 1793 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
1795 | goto err; | 1794 | goto err; |
1796 | 1795 | ||
1797 | msleep(50); | 1796 | msleep(50); |
1798 | 1797 | ||
1799 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 1798 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
1800 | goto err; | 1799 | goto err; |
1801 | 1800 | ||
1802 | if (state->config->tuner_get_status) { | 1801 | if (state->config->tuner_get_status) { |
@@ -1809,7 +1808,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) | |||
1809 | else | 1808 | else |
1810 | dprintk(FE_DEBUG, 1, "Tuner unlocked"); | 1809 | dprintk(FE_DEBUG, 1, "Tuner unlocked"); |
1811 | 1810 | ||
1812 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 1811 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
1813 | goto err; | 1812 | goto err; |
1814 | 1813 | ||
1815 | } | 1814 | } |
@@ -1822,7 +1821,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) | |||
1822 | return srate_coarse; | 1821 | return srate_coarse; |
1823 | 1822 | ||
1824 | err_gateoff: | 1823 | err_gateoff: |
1825 | stv090x_i2c_gate_ctrl(fe, 0); | 1824 | stv090x_i2c_gate_ctrl(state, 0); |
1826 | err: | 1825 | err: |
1827 | dprintk(FE_ERROR, 1, "I/O error"); | 1826 | dprintk(FE_ERROR, 1, "I/O error"); |
1828 | return -1; | 1827 | return -1; |
@@ -2167,7 +2166,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) | |||
2167 | freq -= cur_step * car_step; | 2166 | freq -= cur_step * car_step; |
2168 | 2167 | ||
2169 | /* Setup tuner */ | 2168 | /* Setup tuner */ |
2170 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 2169 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
2171 | goto err; | 2170 | goto err; |
2172 | 2171 | ||
2173 | if (state->config->tuner_set_frequency) { | 2172 | if (state->config->tuner_set_frequency) { |
@@ -2180,12 +2179,12 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) | |||
2180 | goto err_gateoff; | 2179 | goto err_gateoff; |
2181 | } | 2180 | } |
2182 | 2181 | ||
2183 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 2182 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
2184 | goto err; | 2183 | goto err; |
2185 | 2184 | ||
2186 | msleep(50); | 2185 | msleep(50); |
2187 | 2186 | ||
2188 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 2187 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
2189 | goto err; | 2188 | goto err; |
2190 | 2189 | ||
2191 | if (state->config->tuner_get_status) { | 2190 | if (state->config->tuner_get_status) { |
@@ -2198,7 +2197,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) | |||
2198 | else | 2197 | else |
2199 | dprintk(FE_DEBUG, 1, "Tuner unlocked"); | 2198 | dprintk(FE_DEBUG, 1, "Tuner unlocked"); |
2200 | 2199 | ||
2201 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 2200 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
2202 | goto err; | 2201 | goto err; |
2203 | 2202 | ||
2204 | STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1c); | 2203 | STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1c); |
@@ -2222,7 +2221,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) | |||
2222 | return lock; | 2221 | return lock; |
2223 | 2222 | ||
2224 | err_gateoff: | 2223 | err_gateoff: |
2225 | stv090x_i2c_gate_ctrl(fe, 0); | 2224 | stv090x_i2c_gate_ctrl(state, 0); |
2226 | err: | 2225 | err: |
2227 | dprintk(FE_ERROR, 1, "I/O error"); | 2226 | dprintk(FE_ERROR, 1, "I/O error"); |
2228 | return -1; | 2227 | return -1; |
@@ -2591,7 +2590,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st | |||
2591 | } | 2590 | } |
2592 | state->delsys = stv090x_get_std(state); | 2591 | state->delsys = stv090x_get_std(state); |
2593 | 2592 | ||
2594 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 2593 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
2595 | goto err; | 2594 | goto err; |
2596 | 2595 | ||
2597 | if (state->config->tuner_get_frequency) { | 2596 | if (state->config->tuner_get_frequency) { |
@@ -2599,7 +2598,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st | |||
2599 | goto err_gateoff; | 2598 | goto err_gateoff; |
2600 | } | 2599 | } |
2601 | 2600 | ||
2602 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 2601 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
2603 | goto err; | 2602 | goto err; |
2604 | 2603 | ||
2605 | offst_freq = stv090x_get_car_freq(state, state->internal->mclk) / 1000; | 2604 | offst_freq = stv090x_get_car_freq(state, state->internal->mclk) / 1000; |
@@ -2619,7 +2618,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st | |||
2619 | 2618 | ||
2620 | if ((state->algo == STV090x_BLIND_SEARCH) || (state->srate < 10000000)) { | 2619 | if ((state->algo == STV090x_BLIND_SEARCH) || (state->srate < 10000000)) { |
2621 | 2620 | ||
2622 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 2621 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
2623 | goto err; | 2622 | goto err; |
2624 | 2623 | ||
2625 | if (state->config->tuner_get_frequency) { | 2624 | if (state->config->tuner_get_frequency) { |
@@ -2627,7 +2626,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st | |||
2627 | goto err_gateoff; | 2626 | goto err_gateoff; |
2628 | } | 2627 | } |
2629 | 2628 | ||
2630 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 2629 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
2631 | goto err; | 2630 | goto err; |
2632 | 2631 | ||
2633 | if (abs(offst_freq) <= ((state->search_range / 2000) + 500)) | 2632 | if (abs(offst_freq) <= ((state->search_range / 2000) + 500)) |
@@ -2646,7 +2645,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st | |||
2646 | return STV090x_OUTOFRANGE; | 2645 | return STV090x_OUTOFRANGE; |
2647 | 2646 | ||
2648 | err_gateoff: | 2647 | err_gateoff: |
2649 | stv090x_i2c_gate_ctrl(fe, 0); | 2648 | stv090x_i2c_gate_ctrl(state, 0); |
2650 | err: | 2649 | err: |
2651 | dprintk(FE_ERROR, 1, "I/O error"); | 2650 | dprintk(FE_ERROR, 1, "I/O error"); |
2652 | return -1; | 2651 | return -1; |
@@ -3000,7 +2999,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) | |||
3000 | 2999 | ||
3001 | if (state->algo != STV090x_WARM_SEARCH) { | 3000 | if (state->algo != STV090x_WARM_SEARCH) { |
3002 | 3001 | ||
3003 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 3002 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
3004 | goto err; | 3003 | goto err; |
3005 | 3004 | ||
3006 | if (state->config->tuner_set_bandwidth) { | 3005 | if (state->config->tuner_set_bandwidth) { |
@@ -3008,7 +3007,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) | |||
3008 | goto err_gateoff; | 3007 | goto err_gateoff; |
3009 | } | 3008 | } |
3010 | 3009 | ||
3011 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 3010 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
3012 | goto err; | 3011 | goto err; |
3013 | 3012 | ||
3014 | } | 3013 | } |
@@ -3059,7 +3058,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) | |||
3059 | return 0; | 3058 | return 0; |
3060 | 3059 | ||
3061 | err_gateoff: | 3060 | err_gateoff: |
3062 | stv090x_i2c_gate_ctrl(fe, 0); | 3061 | stv090x_i2c_gate_ctrl(state, 0); |
3063 | err: | 3062 | err: |
3064 | dprintk(FE_ERROR, 1, "I/O error"); | 3063 | dprintk(FE_ERROR, 1, "I/O error"); |
3065 | return -1; | 3064 | return -1; |
@@ -3235,7 +3234,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) | |||
3235 | } | 3234 | } |
3236 | 3235 | ||
3237 | /* Setup tuner */ | 3236 | /* Setup tuner */ |
3238 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 3237 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
3239 | goto err; | 3238 | goto err; |
3240 | 3239 | ||
3241 | if (state->config->tuner_set_bbgain) { | 3240 | if (state->config->tuner_set_bbgain) { |
@@ -3256,17 +3255,17 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) | |||
3256 | goto err_gateoff; | 3255 | goto err_gateoff; |
3257 | } | 3256 | } |
3258 | 3257 | ||
3259 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 3258 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
3260 | goto err; | 3259 | goto err; |
3261 | 3260 | ||
3262 | msleep(50); | 3261 | msleep(50); |
3263 | 3262 | ||
3264 | if (state->config->tuner_get_status) { | 3263 | if (state->config->tuner_get_status) { |
3265 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 3264 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
3266 | goto err; | 3265 | goto err; |
3267 | if (state->config->tuner_get_status(fe, ®) < 0) | 3266 | if (state->config->tuner_get_status(fe, ®) < 0) |
3268 | goto err_gateoff; | 3267 | goto err_gateoff; |
3269 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 3268 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
3270 | goto err; | 3269 | goto err; |
3271 | 3270 | ||
3272 | if (reg) | 3271 | if (reg) |
@@ -3400,7 +3399,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) | |||
3400 | return signal_state; | 3399 | return signal_state; |
3401 | 3400 | ||
3402 | err_gateoff: | 3401 | err_gateoff: |
3403 | stv090x_i2c_gate_ctrl(fe, 0); | 3402 | stv090x_i2c_gate_ctrl(state, 0); |
3404 | err: | 3403 | err: |
3405 | dprintk(FE_ERROR, 1, "I/O error"); | 3404 | dprintk(FE_ERROR, 1, "I/O error"); |
3406 | return -1; | 3405 | return -1; |
@@ -4336,7 +4335,7 @@ static int stv090x_init(struct dvb_frontend *fe) | |||
4336 | if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0) | 4335 | if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0) |
4337 | goto err; | 4336 | goto err; |
4338 | 4337 | ||
4339 | if (stv090x_i2c_gate_ctrl(fe, 1) < 0) | 4338 | if (stv090x_i2c_gate_ctrl(state, 1) < 0) |
4340 | goto err; | 4339 | goto err; |
4341 | 4340 | ||
4342 | if (config->tuner_set_mode) { | 4341 | if (config->tuner_set_mode) { |
@@ -4349,7 +4348,7 @@ static int stv090x_init(struct dvb_frontend *fe) | |||
4349 | goto err_gateoff; | 4348 | goto err_gateoff; |
4350 | } | 4349 | } |
4351 | 4350 | ||
4352 | if (stv090x_i2c_gate_ctrl(fe, 0) < 0) | 4351 | if (stv090x_i2c_gate_ctrl(state, 0) < 0) |
4353 | goto err; | 4352 | goto err; |
4354 | 4353 | ||
4355 | if (stv090x_set_tspath(state) < 0) | 4354 | if (stv090x_set_tspath(state) < 0) |
@@ -4358,7 +4357,7 @@ static int stv090x_init(struct dvb_frontend *fe) | |||
4358 | return 0; | 4357 | return 0; |
4359 | 4358 | ||
4360 | err_gateoff: | 4359 | err_gateoff: |
4361 | stv090x_i2c_gate_ctrl(fe, 0); | 4360 | stv090x_i2c_gate_ctrl(state, 0); |
4362 | err: | 4361 | err: |
4363 | dprintk(FE_ERROR, 1, "I/O error"); | 4362 | dprintk(FE_ERROR, 1, "I/O error"); |
4364 | return -1; | 4363 | return -1; |
@@ -4503,8 +4502,6 @@ static struct dvb_frontend_ops stv090x_ops = { | |||
4503 | .sleep = stv090x_sleep, | 4502 | .sleep = stv090x_sleep, |
4504 | .get_frontend_algo = stv090x_frontend_algo, | 4503 | .get_frontend_algo = stv090x_frontend_algo, |
4505 | 4504 | ||
4506 | .i2c_gate_ctrl = stv090x_i2c_gate_ctrl, | ||
4507 | |||
4508 | .diseqc_send_master_cmd = stv090x_send_diseqc_msg, | 4505 | .diseqc_send_master_cmd = stv090x_send_diseqc_msg, |
4509 | .diseqc_send_burst = stv090x_send_diseqc_burst, | 4506 | .diseqc_send_burst = stv090x_send_diseqc_burst, |
4510 | .diseqc_recv_slave_reply = stv090x_recv_slave_reply, | 4507 | .diseqc_recv_slave_reply = stv090x_recv_slave_reply, |