aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-simple.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-04-22 13:45:52 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:49 -0400
commita81df363554fb6439b5eb4ada06ad546a1df5ce3 (patch)
tree9744ce1e24d63a1dbfdc123c9e5e569b9fede9a9 /drivers/media/video/tuner-simple.c
parent62325497db6ef3b13cae41d5038e2693997d7d3e (diff)
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: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-simple.c')
-rw-r--r--drivers/media/video/tuner-simple.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index d6d922c32bce..3ec76391a60d 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -149,7 +149,12 @@ static inline int tuner_afcstatus(const int status)
149static int simple_get_status(struct dvb_frontend *fe, u32 *status) 149static int simple_get_status(struct dvb_frontend *fe, u32 *status)
150{ 150{
151 struct tuner_simple_priv *priv = fe->tuner_priv; 151 struct tuner_simple_priv *priv = fe->tuner_priv;
152 int tuner_status = tuner_read_status(fe); 152 int tuner_status;
153
154 if (priv->i2c_props.adap == NULL)
155 return -EINVAL;
156
157 tuner_status = tuner_read_status(fe);
153 158
154 *status = 0; 159 *status = 0;
155 160
@@ -166,7 +171,12 @@ static int simple_get_status(struct dvb_frontend *fe, u32 *status)
166static int simple_get_rf_strength(struct dvb_frontend *fe, u16 *strength) 171static int simple_get_rf_strength(struct dvb_frontend *fe, u16 *strength)
167{ 172{
168 struct tuner_simple_priv *priv = fe->tuner_priv; 173 struct tuner_simple_priv *priv = fe->tuner_priv;
169 int signal = tuner_signal(tuner_read_status(fe)); 174 int signal;
175
176 if (priv->i2c_props.adap == NULL)
177 return -EINVAL;
178
179 signal = tuner_signal(tuner_read_status(fe));
170 180
171 *strength = signal; 181 *strength = signal;
172 182
@@ -685,6 +695,9 @@ static int simple_set_params(struct dvb_frontend *fe,
685 struct tuner_simple_priv *priv = fe->tuner_priv; 695 struct tuner_simple_priv *priv = fe->tuner_priv;
686 int ret = -EINVAL; 696 int ret = -EINVAL;
687 697
698 if (priv->i2c_props.adap == NULL)
699 return -EINVAL;
700
688 switch (params->mode) { 701 switch (params->mode) {
689 case V4L2_TUNER_RADIO: 702 case V4L2_TUNER_RADIO:
690 ret = simple_set_radio_freq(fe, params); 703 ret = simple_set_radio_freq(fe, params);