summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-02-17 09:41:31 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2008-02-17 09:41:31 -0500
commit63d1236173763de03a559afb07ab06076b58c94d (patch)
tree9407ab7c478376c12f2d062d0539a689c959f7fa /linux/drivers/media/video
parentd7a21fddc3715e75592fc3bbca4b9f41d5d6c3df (diff)
downloadmediapointer-dvb-s2-63d1236173763de03a559afb07ab06076b58c94d.tar.gz
mediapointer-dvb-s2-63d1236173763de03a559afb07ab06076b58c94d.tar.bz2
tuner-simple: do not send i2c commands if there is no i2c adapter
From: Michael Krufky <mkrufky@linuxtv.org> 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: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r--linux/drivers/media/video/tuner-simple.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/linux/drivers/media/video/tuner-simple.c b/linux/drivers/media/video/tuner-simple.c
index 5c82e73c6..3a1c951b7 100644
--- a/linux/drivers/media/video/tuner-simple.c
+++ b/linux/drivers/media/video/tuner-simple.c
@@ -163,7 +163,12 @@ static inline int tuner_mode(const int status)
static int simple_get_status(struct dvb_frontend *fe, u32 *status)
{
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;
@@ -180,7 +185,12 @@ static int simple_get_status(struct dvb_frontend *fe, u32 *status)
static int simple_get_rf_strength(struct dvb_frontend *fe, u16 *strength)
{
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;
@@ -712,6 +722,9 @@ static int simple_set_params(struct dvb_frontend *fe,
struct tuner_simple_priv *priv = fe->tuner_priv;
int ret = -EINVAL;
+ if (priv->i2c_props.adap == NULL)
+ return -EINVAL;
+
switch (params->mode) {
case V4L2_TUNER_RADIO:
ret = simple_set_radio_freq(fe, params);