diff options
author | Andreas Oberritter <obi@linuxtv.org> | 2011-08-04 12:33:15 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-03 08:49:07 -0300 |
commit | 77b1e2fbbdfa0ee5cdf6c928b711493a3738468e (patch) | |
tree | 01ea38d60c3e1e32589eb0151f63700e35e28cc8 /drivers/media/dvb/dvb-core | |
parent | 20640bea87c31a823dba3756b1a5248197f0905f (diff) |
[media] DVB: dvb_frontend: update locking in dvb_frontend_{add, get_event}
- fepriv->parameters_out isn't protected by events->mtx, so
move the call to fe->ops.get_frontend out of the locked area.
- move the assignment of e->status into the locked area.
- use direct assignment instead of memcpy.
- use mutex_lock instead of mutex_lock_interruptible, because
all code paths protected by this mutex won't block.
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-core')
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 41023111220..d02c32e754f 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -149,30 +149,25 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) dprintk ("%s\n", __func__); - if (mutex_lock_interruptible (&events->mtx)) - return; + if ((status & FE_HAS_LOCK) && fe->ops.get_frontend) + fe->ops.get_frontend(fe, &fepriv->parameters_out); - wp = (events->eventw + 1) % MAX_EVENT; + mutex_lock(&events->mtx); + wp = (events->eventw + 1) % MAX_EVENT; if (wp == events->eventr) { events->overflow = 1; events->eventr = (events->eventr + 1) % MAX_EVENT; } e = &events->events[events->eventw]; - - if (status & FE_HAS_LOCK) - if (fe->ops.get_frontend) - fe->ops.get_frontend(fe, &fepriv->parameters_out); - + e->status = status; e->parameters = fepriv->parameters_out; events->eventw = wp; mutex_unlock(&events->mtx); - e->status = status; - wake_up_interruptible (&events->wait_queue); } @@ -207,14 +202,9 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, return ret; } - if (mutex_lock_interruptible (&events->mtx)) - return -ERESTARTSYS; - - memcpy (event, &events->events[events->eventr], - sizeof(struct dvb_frontend_event)); - + mutex_lock(&events->mtx); + *event = events->events[events->eventr]; events->eventr = (events->eventr + 1) % MAX_EVENT; - mutex_unlock(&events->mtx); return 0; |