Commit a81df363 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (7348): tuner-simple: do not send i2c commands if there is no i2c adapter

if (priv->i2c_props.adap == NULL) then exit any function that would
send commands over the i2c bus.  We allow drivers to attach without an
i2c adapter for cases where the dvb demod accesses the tuner directly
via calc_regs.
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 62325497
...@@ -149,7 +149,12 @@ static inline int tuner_afcstatus(const int status) ...@@ -149,7 +149,12 @@ static inline int tuner_afcstatus(const int status)
static int simple_get_status(struct dvb_frontend *fe, u32 *status) static int simple_get_status(struct dvb_frontend *fe, u32 *status)
{ {
struct tuner_simple_priv *priv = fe->tuner_priv; struct tuner_simple_priv *priv = fe->tuner_priv;
int tuner_status = tuner_read_status(fe); int tuner_status;
if (priv->i2c_props.adap == NULL)
return -EINVAL;
tuner_status = tuner_read_status(fe);
*status = 0; *status = 0;
...@@ -166,7 +171,12 @@ static int simple_get_status(struct dvb_frontend *fe, u32 *status) ...@@ -166,7 +171,12 @@ static int simple_get_status(struct dvb_frontend *fe, u32 *status)
static int simple_get_rf_strength(struct dvb_frontend *fe, u16 *strength) static int simple_get_rf_strength(struct dvb_frontend *fe, u16 *strength)
{ {
struct tuner_simple_priv *priv = fe->tuner_priv; struct tuner_simple_priv *priv = fe->tuner_priv;
int signal = tuner_signal(tuner_read_status(fe)); int signal;
if (priv->i2c_props.adap == NULL)
return -EINVAL;
signal = tuner_signal(tuner_read_status(fe));
*strength = signal; *strength = signal;
...@@ -685,6 +695,9 @@ static int simple_set_params(struct dvb_frontend *fe, ...@@ -685,6 +695,9 @@ static int simple_set_params(struct dvb_frontend *fe,
struct tuner_simple_priv *priv = fe->tuner_priv; struct tuner_simple_priv *priv = fe->tuner_priv;
int ret = -EINVAL; int ret = -EINVAL;
if (priv->i2c_props.adap == NULL)
return -EINVAL;
switch (params->mode) { switch (params->mode) {
case V4L2_TUNER_RADIO: case V4L2_TUNER_RADIO:
ret = simple_set_radio_freq(fe, params); ret = simple_set_radio_freq(fe, params);
......
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