Skip to content

Commit

Permalink
V4L/DVB (5946): Use mutex instead of semaphore in the DVB frontend tu…
Browse files Browse the repository at this point in the history
…ning interface

The DVB frontend tuning interface uses a semaphore as mutex. Use the
mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Matthias Kaehlcke authored and Mauro Carvalho Chehab committed Oct 10, 2007
1 parent 667c7bc commit 03b7612
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions drivers/media/dvb/dvb-core/dvb_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)

dprintk ("%s\n", __FUNCTION__);

if (down_interruptible (&events->sem))
if (mutex_lock_interruptible (&events->mtx))
return;

wp = (events->eventw + 1) % MAX_EVENT;
Expand All @@ -159,7 +159,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)

events->eventw = wp;

up (&events->sem);
mutex_unlock(&events->mtx);

e->status = status;

Expand Down Expand Up @@ -197,15 +197,15 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe,
return ret;
}

if (down_interruptible (&events->sem))
if (mutex_lock_interruptible (&events->mtx))
return -ERESTARTSYS;

memcpy (event, &events->events[events->eventr],
sizeof(struct dvb_frontend_event));

events->eventr = (events->eventr + 1) % MAX_EVENT;

up (&events->sem);
mutex_unlock(&events->mtx);

return 0;
}
Expand Down Expand Up @@ -1126,7 +1126,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
init_MUTEX (&fepriv->sem);
init_waitqueue_head (&fepriv->wait_queue);
init_waitqueue_head (&fepriv->events.wait_queue);
init_MUTEX (&fepriv->events.sem);
mutex_init(&fepriv->events.mtx);
fe->dvb = dvb;
fepriv->inversion = INVERSION_OFF;

Expand Down
3 changes: 2 additions & 1 deletion drivers/media/dvb/dvb-core/dvb_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/mutex.h>

#include <linux/dvb/frontend.h>

Expand Down Expand Up @@ -142,7 +143,7 @@ struct dvb_fe_events {
int eventr;
int overflow;
wait_queue_head_t wait_queue;
struct semaphore sem;
struct mutex mtx;
};

struct dvb_frontend {
Expand Down

0 comments on commit 03b7612

Please sign in to comment.