aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-01-17 13:20:37 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-17 13:20:37 -0500
commit51dcb19aaf9448f6547f653b60a9f083845aad4a (patch)
tree0e428e66df6e83c90a5bb0129c15fc117f4ceb75 /drivers/media
parent7bb0f088f8dd1d60b8f5743471cc3db3f820df59 (diff)
[media] dvb_frontend: Don't call get_frontend() if idle
If the frontend is in idle state, don't call get_frontend. Calling get_frontend() when the device is not tuned may result in wrong parameters to be returned to the userspace. I was tempted to not call get_frontend() at all, except inside the dvb frontend thread, but this won't work for all cases. The ISDB-T specs (ABNT NBR 15601 and ARIB STD-B31) allow the broadcaster to dynamically change the channel specs at runtime. That means that an ISDB-T optimized application may want/need to monitor the TMCC tables, decoded at the frontends via get_frontend call. So, let's do the simpler change here. Eventually, the logic could be changed to work only if the device is tuned and has lock, but, even so, the lock is also standard-dependent. For ISDB-T, the right lock to wait is that the demod has TMCC lock. So, drivers may need to implement some logic to detect if the get_frontend info was retrieved or not. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index f5fa7aa89618..2998f38d64a2 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1744,6 +1744,7 @@ static int dvb_frontend_ioctl_properties(struct file *file,
1744{ 1744{
1745 struct dvb_device *dvbdev = file->private_data; 1745 struct dvb_device *dvbdev = file->private_data;
1746 struct dvb_frontend *fe = dvbdev->priv; 1746 struct dvb_frontend *fe = dvbdev->priv;
1747 struct dvb_frontend_private *fepriv = fe->frontend_priv;
1747 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1748 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1748 int err = 0; 1749 int err = 0;
1749 1750
@@ -1810,9 +1811,14 @@ static int dvb_frontend_ioctl_properties(struct file *file,
1810 1811
1811 /* 1812 /*
1812 * Fills the cache out struct with the cache contents, plus 1813 * Fills the cache out struct with the cache contents, plus
1813 * the data retrieved from get_frontend. 1814 * the data retrieved from get_frontend, if the frontend
1815 * is not idle. Otherwise, returns the cached content
1814 */ 1816 */
1815 dtv_get_frontend(fe, NULL); 1817 if (fepriv->state != FESTATE_IDLE) {
1818 err = dtv_get_frontend(fe, NULL);
1819 if (err < 0)
1820 goto out;
1821 }
1816 for (i = 0; i < tvps->num; i++) { 1822 for (i = 0; i < tvps->num; i++) {
1817 err = dtv_property_process_get(fe, c, tvp + i, file); 1823 err = dtv_property_process_get(fe, c, tvp + i, file);
1818 if (err < 0) 1824 if (err < 0)