Em Mon, 7 Jan 2013 16:44:15 -0200 Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> escreveu: > Add the logic to poll, reset counters and report the QoS stats > to the end user. > > The idea is that the core will periodically poll the frontend for > the stats. The frontend may return -EBUSY, if the previous collect > didn't finish, or it may fill the cached data. > > The value returned to the end user is always the cached data. > It is probably better to have a routine to reset the counters, and do the cache cleanup there, instead duplicating it on each frontend driver. So, I'll amend the following driver on my version. I won't be posting a v9 just due to that. My intention is to post v9 together with a driver's code. Regards, Mauro diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index f8be7be..b8bd674 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1677,6 +1677,25 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) return 0; } +static int reset_qos_counters(struct dvb_frontend *fe) +{ + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + + /* Reset QoS cache */ + + memset (&c->strength, 0, sizeof(c->strength)); + memset (&c->cnr, 0, sizeof(c->cnr)); + memset (&c->bit_error, 0, sizeof(c->bit_error)); + memset (&c->block_error, 0, sizeof(c->block_error)); + memset (&c->block_count, 0, sizeof(c->block_count)); + + /* Call frontend reset counter method, if available */ + if (fe->ops.reset_qos_counters) + return fe->ops.reset_qos_counters(fe); + + return 0; +} + static int dtv_property_process_set(struct dvb_frontend *fe, struct dtv_property *tvp, struct file *file) @@ -1736,8 +1755,8 @@ static int dtv_property_process_set(struct dvb_frontend *fe, break; case DTV_DELIVERY_SYSTEM: r = set_delivery_system(fe, tvp->u.data); - if (r >= 0 && fe->ops.reset_qos_counters) - fe->ops.reset_qos_counters(fe); + if (r >= 0) + reset_qos_counters(fe); break; case DTV_VOLTAGE: c->voltage = tvp->u.data; @@ -2338,8 +2357,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file, if (err) break; err = dtv_set_frontend(fe); - if (err >= 0 && fe->ops.reset_qos_counters) - fe->ops.reset_qos_counters(fe); + if (err >= 0) + reset_qos_counters(fe); break; case FE_GET_EVENT: -- Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html