diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-07-30 13:58:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:03:34 -0400 |
commit | 03b7612336560c6799852acaaaeac70e1f00e483 (patch) | |
tree | dad10f437837c1cb1f962e3577f54923f9faf21f | |
parent | 667c7bc0aff18288186f1223784b57f77be7d81b (diff) |
V4L/DVB (5946): Use mutex instead of semaphore in the DVB frontend tuning 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>
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 10 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.h | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 384b5b8959c1..afe797b75de4 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -138,7 +138,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) | |||
138 | 138 | ||
139 | dprintk ("%s\n", __FUNCTION__); | 139 | dprintk ("%s\n", __FUNCTION__); |
140 | 140 | ||
141 | if (down_interruptible (&events->sem)) | 141 | if (mutex_lock_interruptible (&events->mtx)) |
142 | return; | 142 | return; |
143 | 143 | ||
144 | wp = (events->eventw + 1) % MAX_EVENT; | 144 | wp = (events->eventw + 1) % MAX_EVENT; |
@@ -159,7 +159,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) | |||
159 | 159 | ||
160 | events->eventw = wp; | 160 | events->eventw = wp; |
161 | 161 | ||
162 | up (&events->sem); | 162 | mutex_unlock(&events->mtx); |
163 | 163 | ||
164 | e->status = status; | 164 | e->status = status; |
165 | 165 | ||
@@ -197,7 +197,7 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, | |||
197 | return ret; | 197 | return ret; |
198 | } | 198 | } |
199 | 199 | ||
200 | if (down_interruptible (&events->sem)) | 200 | if (mutex_lock_interruptible (&events->mtx)) |
201 | return -ERESTARTSYS; | 201 | return -ERESTARTSYS; |
202 | 202 | ||
203 | memcpy (event, &events->events[events->eventr], | 203 | memcpy (event, &events->events[events->eventr], |
@@ -205,7 +205,7 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, | |||
205 | 205 | ||
206 | events->eventr = (events->eventr + 1) % MAX_EVENT; | 206 | events->eventr = (events->eventr + 1) % MAX_EVENT; |
207 | 207 | ||
208 | up (&events->sem); | 208 | mutex_unlock(&events->mtx); |
209 | 209 | ||
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
@@ -1126,7 +1126,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb, | |||
1126 | init_MUTEX (&fepriv->sem); | 1126 | init_MUTEX (&fepriv->sem); |
1127 | init_waitqueue_head (&fepriv->wait_queue); | 1127 | init_waitqueue_head (&fepriv->wait_queue); |
1128 | init_waitqueue_head (&fepriv->events.wait_queue); | 1128 | init_waitqueue_head (&fepriv->events.wait_queue); |
1129 | init_MUTEX (&fepriv->events.sem); | 1129 | mutex_init(&fepriv->events.mtx); |
1130 | fe->dvb = dvb; | 1130 | fe->dvb = dvb; |
1131 | fepriv->inversion = INVERSION_OFF; | 1131 | fepriv->inversion = INVERSION_OFF; |
1132 | 1132 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h index a770a87b9a93..f95de63d0e24 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb/dvb-core/dvb_frontend.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/mutex.h> | ||
38 | 39 | ||
39 | #include <linux/dvb/frontend.h> | 40 | #include <linux/dvb/frontend.h> |
40 | 41 | ||
@@ -142,7 +143,7 @@ struct dvb_fe_events { | |||
142 | int eventr; | 143 | int eventr; |
143 | int overflow; | 144 | int overflow; |
144 | wait_queue_head_t wait_queue; | 145 | wait_queue_head_t wait_queue; |
145 | struct semaphore sem; | 146 | struct mutex mtx; |
146 | }; | 147 | }; |
147 | 148 | ||
148 | struct dvb_frontend { | 149 | struct dvb_frontend { |