Merge branch 'vuplus-1.6' of 192.168.102.66:/var/ikseong/repo/openembedded into test_0921
[vuplus_openembedded] / recipes / v4l-dvb / files / backport-h.patch
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
5
6 Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
7 ---
8  drivers/media/dvb/dvb-core/dvb_frontend.c |   23 +++++++++++------------
9  1 files changed, 11 insertions(+), 12 deletions(-)
10
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
13 @@ -115,7 +115,7 @@
14         struct dvb_frontend_parameters parameters_in;
15         struct dvb_frontend_parameters parameters_out;
16         struct dvb_fe_events events;
17 -       struct semaphore sem;
18 +       struct mutex lock;
19         struct list_head list_head;
20         wait_queue_head_t wait_queue;
21         struct task_struct *thread;
22 @@ -197,12 +197,12 @@
23                 if (flags & O_NONBLOCK)
24                         return -EWOULDBLOCK;
25  
26 -               up(&fepriv->sem);
27 +               mutex_unlock(&fepriv->lock);
28  
29                 ret = wait_event_interruptible (events->wait_queue,
30                                                 events->eventw != events->eventr);
31  
32 -               if (down_interruptible (&fepriv->sem))
33 +               if (mutex_lock_interruptible(&fepriv->lock))
34                         return -ERESTARTSYS;
35  
36                 if (ret < 0)
37 @@ -563,7 +563,7 @@
38  
39         set_freezable();
40         while (1) {
41 -               up(&fepriv->sem);           /* is locked when we enter the thread... */
42 +               mutex_unlock(&fepriv->lock);        /* is locked when we enter the thread... */
43  restart:
44  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
45                 timeout = wait_event_interruptible_timeout(fepriv->wait_queue,
46 @@ -585,7 +585,7 @@
47                 if (try_to_freeze())
48                         goto restart;
49  
50 -               if (down_interruptible(&fepriv->sem))
51 +               if (mutex_lock_interruptible(&fepriv->lock))
52                         break;
53  
54                 if (fepriv->reinitialise) {
55 @@ -717,7 +717,7 @@
56  
57         kthread_stop(fepriv->thread);
58  
59 -       init_MUTEX (&fepriv->sem);
60 +       mutex_init (&fepriv->lock);
61         fepriv->state = FESTATE_IDLE;
62  
63         /* paranoia check in case a signal arrived */
64 @@ -786,7 +786,7 @@
65  
66         if (signal_pending(current))
67                 return -EINTR;
68 -       if (down_interruptible (&fepriv->sem))
69 +       if (mutex_lock_interruptible(&fepriv->lock))
70                 return -EINTR;
71  
72         fepriv->state = FESTATE_IDLE;
73 @@ -799,7 +799,7 @@
74         if (IS_ERR(fe_thread)) {
75                 ret = PTR_ERR(fe_thread);
76                 printk("dvb_frontend_start: failed to start kthread (%d)\n", ret);
77 -               up(&fepriv->sem);
78 +               mutex_unlock(&fepriv->lock);
79                 return ret;
80         }
81         fepriv->thread = fe_thread;
82 @@ -1549,7 +1549,7 @@
83              cmd == FE_DISEQC_RECV_SLAVE_REPLY))
84                 return -EPERM;
85  
86 -       if (down_interruptible (&fepriv->sem))
87 +       if (mutex_lock_interruptible(&fepriv->lock))
88                 return -ERESTARTSYS;
89  
90         if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY))
91 @@ -1559,7 +1559,7 @@
92                 err = dvb_frontend_ioctl_legacy(inode, file, cmd, parg);
93         }
94  
95 -       up(&fepriv->sem);
96 +       mutex_unlock(&fepriv->lock);
97         return err;
98  }
99  
100 @@ -2120,7 +2120,7 @@
101         }
102         fepriv = fe->frontend_priv;
103  
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);