V4L/DVB (6783): tuner: combine set_tv_freq and set_radio_freq into a single set_params method

We can tell whether we are tuning television or radio by testing for
struct analog_parameters *params->mode == V4L2_TUNER_RADIO

There is no longer any need for separate set_tv_freq and
set_radio_freq functions in the analog tuner demodulator modules.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index e56a419..5f8bffc 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -78,23 +78,17 @@
 
 /* ---------------------------------------------------------------------- */
 
-static void fe_set_freq(struct dvb_frontend *fe, unsigned int freq)
+static void fe_set_params(struct dvb_frontend *fe,
+			  struct analog_parameters *params)
 {
 	struct dvb_tuner_ops *fe_tuner_ops = &fe->ops.tuner_ops;
 	struct tuner *t = fe->analog_demod_priv;
 
-	struct analog_parameters params = {
-		.frequency = freq,
-		.mode      = t->mode,
-		.audmode   = t->audmode,
-		.std       = t->std
-	};
-
 	if (NULL == fe_tuner_ops->set_analog_params) {
 		tuner_warn("Tuner frontend module has no way to set freq\n");
 		return;
 	}
-	fe_tuner_ops->set_analog_params(fe, &params);
+	fe_tuner_ops->set_analog_params(fe, params);
 }
 
 static void fe_release(struct dvb_frontend *fe)
@@ -136,8 +130,7 @@
 static void tuner_status(struct dvb_frontend *fe);
 
 static struct analog_tuner_ops tuner_core_ops = {
-	.set_tv_freq    = fe_set_freq,
-	.set_radio_freq = fe_set_freq,
+	.set_params     = fe_set_params,
 	.standby        = fe_standby,
 	.release        = fe_release,
 	.has_signal     = fe_has_signal,
@@ -150,11 +143,17 @@
 	struct tuner *t = i2c_get_clientdata(c);
 	struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
 
+	struct analog_parameters params = {
+		.mode      = t->mode,
+		.audmode   = t->audmode,
+		.std       = t->std
+	};
+
 	if (t->type == UNSET) {
 		tuner_warn ("tuner type not set\n");
 		return;
 	}
-	if ((NULL == ops) || (NULL == ops->set_tv_freq)) {
+	if ((NULL == ops) || (NULL == ops->set_params)) {
 		tuner_warn ("Tuner has no way to set tv freq\n");
 		return;
 	}
@@ -169,7 +168,9 @@
 		else
 			freq = tv_range[1] * 16;
 	}
-	ops->set_tv_freq(&t->fe, freq);
+	params.frequency = freq;
+
+	ops->set_params(&t->fe, &params);
 }
 
 static void set_radio_freq(struct i2c_client *c, unsigned int freq)
@@ -177,11 +178,17 @@
 	struct tuner *t = i2c_get_clientdata(c);
 	struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
 
+	struct analog_parameters params = {
+		.mode      = t->mode,
+		.audmode   = t->audmode,
+		.std       = t->std
+	};
+
 	if (t->type == UNSET) {
 		tuner_warn ("tuner type not set\n");
 		return;
 	}
-	if ((NULL == ops) || (NULL == ops->set_radio_freq)) {
+	if ((NULL == ops) || (NULL == ops->set_params)) {
 		tuner_warn ("tuner has no way to set radio frequency\n");
 		return;
 	}
@@ -196,8 +203,9 @@
 		else
 			freq = radio_range[1] * 16000;
 	}
+	params.frequency = freq;
 
-	ops->set_radio_freq(&t->fe, freq);
+	ops->set_params(&t->fe, &params);
 }
 
 static void set_freq(struct i2c_client *c, unsigned long freq)
@@ -359,8 +367,7 @@
 
 	ops = t->fe.ops.analog_demod_ops;
 
-	if (((NULL == ops) ||
-	     ((NULL == ops->set_tv_freq) && (NULL == ops->set_radio_freq))) &&
+	if (((NULL == ops) || (NULL == ops->set_params)) &&
 	    (fe_tuner_ops->set_analog_params)) {
 		strlcpy(t->i2c->name, fe_tuner_ops->info.name,
 			sizeof(t->i2c->name));