summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-07-30 14:58:10 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-30 14:58:10 -0300
commit0ecfe3e409e0436f2cca5bf363499fcf0c3b7f14 (patch)
tree360eac74c93a81d35340cda22bab91f117c80fa7
parenta7c805fd1cc7b2f155334242f642b225cff0a491 (diff)
downloadmediapointer-dvb-s2-0ecfe3e409e0436f2cca5bf363499fcf0c3b7f14.tar.gz
mediapointer-dvb-s2-0ecfe3e409e0436f2cca5bf363499fcf0c3b7f14.tar.bz2
Use mutex instead of semaphore in the DVB frontend tuning interface
From: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> 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> Reviewed-by: Satyam Sharma <satyam@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c10
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.h9
2 files changed, 13 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 08e92187d..a05f4267a 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -143,7 +143,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;
@@ -164,7 +164,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;
@@ -202,7 +202,7 @@ 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],
@@ -210,7 +210,7 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe,
events->eventr = (events->eventr + 1) % MAX_EVENT;
- up (&events->sem);
+ mutex_unlock(&events->mtx);
return 0;
}
@@ -1131,7 +1131,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;
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
index a770a87b9..275ae622f 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -35,6 +35,9 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/delay.h>
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+#include <linux/mutex.h>
+#endif
#include <linux/dvb/frontend.h>
@@ -142,7 +145,11 @@ struct dvb_fe_events {
int eventr;
int overflow;
wait_queue_head_t wait_queue;
- struct semaphore sem;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ struct mutex mtx;
+#else
+ struct semaphore mtx;
+#endif
};
struct dvb_frontend {