1 From a5d426b76cadcf99363d481e11da320fc33786d7 Mon Sep 17 00:00:00 2001
2 From: Andreas Oberritter <obi@linuxtv.org>
3 Date: Wed, 24 Aug 2011 13:18:25 +0000
4 Subject: [PATCH 1/2] DVB: dvb_frontend: convert semaphore to mutex
6 Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
8 drivers/media/dvb/dvb-core/dvb_frontend.c | 23 +++++++++++------------
9 1 files changed, 11 insertions(+), 12 deletions(-)
11 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c 2011-08-24 16:21:05.000000000 +0200
12 +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c 2011-08-24 16:24:55.900270220 +0200
14 struct dvb_frontend_parameters parameters_in;
15 struct dvb_frontend_parameters parameters_out;
16 struct dvb_fe_events events;
17 - struct semaphore sem;
19 struct list_head list_head;
20 wait_queue_head_t wait_queue;
21 struct task_struct *thread;
23 if (flags & O_NONBLOCK)
27 + mutex_unlock(&fepriv->lock);
29 ret = wait_event_interruptible (events->wait_queue,
30 events->eventw != events->eventr);
32 - if (down_interruptible (&fepriv->sem))
33 + if (mutex_lock_interruptible(&fepriv->lock))
41 - up(&fepriv->sem); /* is locked when we enter the thread... */
42 + mutex_unlock(&fepriv->lock); /* is locked when we enter the thread... */
44 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
45 timeout = wait_event_interruptible_timeout(fepriv->wait_queue,
50 - if (down_interruptible(&fepriv->sem))
51 + if (mutex_lock_interruptible(&fepriv->lock))
54 if (fepriv->reinitialise) {
57 kthread_stop(fepriv->thread);
59 - init_MUTEX (&fepriv->sem);
60 + mutex_init (&fepriv->lock);
61 fepriv->state = FESTATE_IDLE;
63 /* paranoia check in case a signal arrived */
66 if (signal_pending(current))
68 - if (down_interruptible (&fepriv->sem))
69 + if (mutex_lock_interruptible(&fepriv->lock))
72 fepriv->state = FESTATE_IDLE;
74 if (IS_ERR(fe_thread)) {
75 ret = PTR_ERR(fe_thread);
76 printk("dvb_frontend_start: failed to start kthread (%d)\n", ret);
78 + mutex_unlock(&fepriv->lock);
81 fepriv->thread = fe_thread;
83 cmd == FE_DISEQC_RECV_SLAVE_REPLY))
86 - if (down_interruptible (&fepriv->sem))
87 + if (mutex_lock_interruptible(&fepriv->lock))
90 if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY))
92 err = dvb_frontend_ioctl_legacy(inode, file, cmd, parg);
96 + mutex_unlock(&fepriv->lock);
100 @@ -2120,7 +2120,7 @@
102 fepriv = fe->frontend_priv;
104 - init_MUTEX (&fepriv->sem);
105 + mutex_init (&fepriv->lock);
106 init_waitqueue_head (&fepriv->wait_queue);
107 init_waitqueue_head (&fepriv->events.wait_queue);
108 mutex_init(&fepriv->events.mtx);