aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-01-22 08:49:39 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-01-22 08:49:39 -0200
commitd36e418a7b1eaeb006ee304533054e2720537db7 (patch)
treebe1ecc4f3dc7475226a71cfca5525a9adf6b3b34
parent04585921ac0fa0f4baaf510cc7e52e3399018fb4 (diff)
[media] mb86a20s: Split status read logic from DVB callback
Split the logic that reads the status from the DVB callback. That helps to properly return an error code, if status read fails. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb-frontends/mb86a20s.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
index 8f4fff1f0fa5..03b74d3afd8f 100644
--- a/drivers/media/dvb-frontends/mb86a20s.c
+++ b/drivers/media/dvb-frontends/mb86a20s.c
@@ -320,16 +320,14 @@ static int mb86a20s_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
static int mb86a20s_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
struct mb86a20s_state *state = fe->demodulator_priv;
- u8 val;
+ int val;
dprintk("\n");
*status = 0;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 0);
val = mb86a20s_readreg(state, 0x0a) & 0xf;
- if (fe->ops.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 1);
+ if (val < 0)
+ return val;
if (val >= 2)
*status |= FE_HAS_SIGNAL;
@@ -635,6 +633,25 @@ error:
}
+static int mb86a20s_read_status_gate(struct dvb_frontend *fe,
+ fe_status_t *status)
+{
+ int ret;
+
+ dprintk("\n");
+ *status = 0;
+
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 0);
+
+ ret = mb86a20s_read_status(fe, status);
+
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1);
+
+ return ret;
+}
+
static int mb86a20s_tune(struct dvb_frontend *fe,
bool re_tune,
unsigned int mode_flags,
@@ -649,7 +666,7 @@ static int mb86a20s_tune(struct dvb_frontend *fe,
rc = mb86a20s_set_frontend(fe);
if (!(mode_flags & FE_TUNE_MODE_ONESHOT))
- mb86a20s_read_status(fe, status);
+ mb86a20s_read_status_gate(fe, status);
return rc;
}
@@ -730,7 +747,7 @@ static struct dvb_frontend_ops mb86a20s_ops = {
.init = mb86a20s_initfe,
.set_frontend = mb86a20s_set_frontend,
.get_frontend = mb86a20s_get_frontend,
- .read_status = mb86a20s_read_status,
+ .read_status = mb86a20s_read_status_gate,
.read_signal_strength = mb86a20s_read_signal_strength,
.tune = mb86a20s_tune,
};

Privacy Policy