]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/media/v4l2-core/tuner-core.c
Merge tag 'renesas-pinctrl-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / drivers / media / v4l2-core / tuner-core.c
index 7d60c5d38ca0dd9e63017f4c8876c51d0db6219a..ddc9379eb2769c308198cb17bc9afde4e4067fb3 100644 (file)
@@ -218,26 +218,6 @@ static void fe_standby(struct dvb_frontend *fe)
                fe_tuner_ops->sleep(fe);
 }
 
-static int fe_has_signal(struct dvb_frontend *fe)
-{
-       u16 strength;
-
-       if (fe->ops.tuner_ops.get_rf_strength(fe, &strength) < 0)
-               return 0;
-
-       return strength;
-}
-
-static int fe_get_afc(struct dvb_frontend *fe)
-{
-       s32 afc;
-
-       if (fe->ops.tuner_ops.get_afc(fe, &afc) < 0)
-               return 0;
-
-       return afc;
-}
-
 static int fe_set_config(struct dvb_frontend *fe, void *priv_cfg)
 {
        struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops;
@@ -446,9 +426,9 @@ static void set_type(struct i2c_client *c, unsigned int type,
                       sizeof(struct analog_demod_ops));
 
                if (fe_tuner_ops->get_rf_strength)
-                       analog_ops->has_signal = fe_has_signal;
+                       analog_ops->has_signal = fe_tuner_ops->get_rf_strength;
                if (fe_tuner_ops->get_afc)
-                       analog_ops->get_afc = fe_get_afc;
+                       analog_ops->get_afc = fe_tuner_ops->get_afc;
 
        } else {
                t->name = analog_ops->info.name;
@@ -1070,9 +1050,12 @@ static void tuner_status(struct dvb_frontend *fe)
                if (tuner_status & TUNER_STATUS_STEREO)
                        tuner_info("Stereo:          yes\n");
        }
-       if (analog_ops->has_signal)
-               tuner_info("Signal strength: %d\n",
-                          analog_ops->has_signal(fe));
+       if (analog_ops->has_signal) {
+               u16 signal;
+
+               if (!analog_ops->has_signal(fe, &signal))
+                       tuner_info("Signal strength: %hu\n", signal);
+       }
 }
 
 /*
@@ -1190,9 +1173,13 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
        if (check_mode(t, vt->type) == -EINVAL)
                return 0;
        if (vt->type == t->mode && analog_ops->get_afc)
-               vt->afc = analog_ops->get_afc(&t->fe);
-       if (analog_ops->has_signal)
-               vt->signal = analog_ops->has_signal(&t->fe);
+               analog_ops->get_afc(&t->fe, &vt->afc);
+       if (vt->type == t->mode && analog_ops->has_signal) {
+               u16 signal = (u16)vt->signal;
+
+               if (!analog_ops->has_signal(&t->fe, &signal))
+                       vt->signal = signal;
+       }
        if (vt->type != V4L2_TUNER_RADIO) {
                vt->capability |= V4L2_TUNER_CAP_NORM;
                vt->rangelow = tv_range[0] * 16;