Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c61d80a authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

[media] dvb: don't require a parameter for get_frontend



Just like set_frontend, use the dvb cache properties for get_frontend.
This is more consistent, as both functions are now symetric. Also,
at the places get_frontend is called, it makes sense to update the
cache.

Most of this patch were generated by this small perl script:

	while (<>) { $file .= $_; }
	if ($file =~ m/\.get_frontend\s*=\s*([\d\w_]+)/) {
		my $get = $1;
		$file =~ s/($get)(\s*\([^\,\)]+)\,\s*struct\s+dtv_frontend_properties\s*\*\s*([_\d\w]+)\)\s*\{/\1\2)\n{\n\tstruct dtv_frontend_properties *\3 = &fe->dtv_property_cache;/g;
	}
	print $file;

Of course, the changes at dvb_frontend.[ch] were made by hand,
as well as the changes on a few other places, where get_frontend()
is called internally inside the driver.

On some places, get_frontend() were just a void function. Those
occurrences were removed, as the DVB core handles such cases.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ac3852c4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1685,8 +1685,9 @@ static int dst_get_tuning_algo(struct dvb_frontend *fe)
	return dst_algo ? DVBFE_ALGO_HW : DVBFE_ALGO_SW;
}

static int dst_get_frontend(struct dvb_frontend *fe, struct dtv_frontend_properties *p)
static int dst_get_frontend(struct dvb_frontend *fe)
{
	struct dtv_frontend_properties *p = &fe->dtv_property_cache;
	struct dst_state *state = fe->demodulator_priv;

	p->frequency = state->decode_freq;
+7 −23
Original line number Diff line number Diff line
@@ -143,7 +143,6 @@ struct dvb_frontend_private {

static void dvb_frontend_wakeup(struct dvb_frontend *fe);
static int dtv_get_frontend(struct dvb_frontend *fe,
			    struct dtv_frontend_properties *c,
			    struct dvb_frontend_parameters *p_out);

static bool has_get_frontend(struct dvb_frontend *fe)
@@ -161,7 +160,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
	dprintk ("%s\n", __func__);

	if ((status & FE_HAS_LOCK) && has_get_frontend(fe))
		dtv_get_frontend(fe, NULL, &fepriv->parameters_out);
		dtv_get_frontend(fe, &fepriv->parameters_out);

	mutex_lock(&events->mtx);

@@ -1261,33 +1260,20 @@ static void dtv_property_cache_submit(struct dvb_frontend *fe)
 * If p_out is not null, it will update the DVBv3 params pointed by it.
 */
static int dtv_get_frontend(struct dvb_frontend *fe,
			    struct dtv_frontend_properties *c,
			    struct dvb_frontend_parameters *p_out)
{
	const struct dtv_frontend_properties *cache = &fe->dtv_property_cache;
	struct dtv_frontend_properties tmp_cache;
	struct dvb_frontend_parameters tmp_out;
	bool fill_params = (p_out != NULL);
	int r;

	if (!p_out)
		p_out = &tmp_out;

	if (!c)
		c = &tmp_cache;
	else
		memcpy(c, cache, sizeof(*c));

	if (fe->ops.get_frontend) {
		r = fe->ops.get_frontend(fe, c);
		r = fe->ops.get_frontend(fe);
		if (unlikely(r < 0))
			return r;
		if (fill_params)
		if (p_out)
			dtv_property_legacy_params_sync(fe, p_out);
		return 0;
	}

	/* As everything is in cache, this is always supported */
	/* As everything is in cache, get_frontend fops are always supported */
	return 0;
}

@@ -1717,8 +1703,6 @@ static int dvb_frontend_ioctl_properties(struct file *file,

	} else
	if(cmd == FE_GET_PROPERTY) {
		struct dtv_frontend_properties cache_out;

		tvps = (struct dtv_properties __user *)parg;

		dprintk("%s() properties.num = %d\n", __func__, tvps->num);
@@ -1744,9 +1728,9 @@ static int dvb_frontend_ioctl_properties(struct file *file,
		 * Fills the cache out struct with the cache contents, plus
		 * the data retrieved from get_frontend.
		 */
		dtv_get_frontend(fe, &cache_out, NULL);
		dtv_get_frontend(fe, NULL);
		for (i = 0; i < tvps->num; i++) {
			err = dtv_property_process_get(fe, &cache_out, tvp + i, file);
			err = dtv_property_process_get(fe, c, tvp + i, file);
			if (err < 0)
				goto out;
			(tvp + i)->result = err;
@@ -2043,7 +2027,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
		break;

	case FE_GET_FRONTEND:
		err = dtv_get_frontend(fe, NULL, &fepriv->parameters_out);
		err = dtv_get_frontend(fe, &fepriv->parameters_out);
		if (err >= 0)
			memcpy(parg, &fepriv->parameters_out,
			       sizeof(struct dvb_frontend_parameters));
+1 −1
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ struct dvb_frontend_ops {
	int (*set_frontend)(struct dvb_frontend *fe);
	int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);

	int (*get_frontend)(struct dvb_frontend *fe, struct dtv_frontend_properties *props);
	int (*get_frontend)(struct dvb_frontend *fe);

	int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
	int (*read_ber)(struct dvb_frontend* fe, u32* ber);
+2 −2
Original line number Diff line number Diff line
@@ -1226,9 +1226,9 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe)
	return 0;
}

static int af9005_fe_get_frontend(struct dvb_frontend *fe,
				  struct dtv_frontend_properties *fep)
static int af9005_fe_get_frontend(struct dvb_frontend *fe)
{
	struct dtv_frontend_properties *fep = &fe->dtv_property_cache;
	struct af9005_fe_state *state = fe->demodulator_priv;
	int ret;
	u8 temp;
+0 −7
Original line number Diff line number Diff line
@@ -296,12 +296,6 @@ static int cinergyt2_fe_set_frontend(struct dvb_frontend *fe)
	return (err < 0) ? err : 0;
}

static int cinergyt2_fe_get_frontend(struct dvb_frontend *fe,
				  struct dtv_frontend_properties *fep)
{
	return 0;
}

static void cinergyt2_fe_release(struct dvb_frontend *fe)
{
	struct cinergyt2_fe_state *state = fe->demodulator_priv;
@@ -352,7 +346,6 @@ static struct dvb_frontend_ops cinergyt2_fe_ops = {
	.sleep			= cinergyt2_fe_sleep,

	.set_frontend		= cinergyt2_fe_set_frontend,
	.get_frontend		= cinergyt2_fe_get_frontend,
	.get_tune_settings	= cinergyt2_fe_get_tune_settings,

	.read_status		= cinergyt2_fe_read_status,
Loading