diff options
author | Andreas Oberritter <obi@linuxtv.org> | 2011-08-04 17:33:14 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-03 13:48:12 +0200 |
commit | 20640bea87c31a823dba3756b1a5248197f0905f (patch) | |
tree | 94ec37c20fb7f99b18a0e4b2e17d97ad5bf536f6 | |
parent | [media] DVB: dvb_frontend: avoid possible race condition on first event (diff) | |
download | linux-20640bea87c31a823dba3756b1a5248197f0905f.tar.xz linux-20640bea87c31a823dba3756b1a5248197f0905f.zip |
[media] DVB: dvb_frontend: clear stale events on FE_SET_FRONTEND
the first event after an attempt to tune.
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 45ea843d93de..410231112204 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -220,6 +220,16 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, return 0; } +static void dvb_frontend_clear_events(struct dvb_frontend *fe) +{ + struct dvb_frontend_private *fepriv = fe->frontend_priv; + struct dvb_fe_events *events = &fepriv->events; + + mutex_lock(&events->mtx); + events->eventr = events->eventw; + mutex_unlock(&events->mtx); +} + static void dvb_frontend_init(struct dvb_frontend *fe) { dprintk ("DVB: initialising adapter %i frontend %i (%s)...\n", @@ -1891,6 +1901,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file, /* Request the search algorithm to search */ fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; + dvb_frontend_clear_events(fe); dvb_frontend_add_event(fe, 0); dvb_frontend_wakeup(fe); fepriv->status = 0; |