aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-07-02 09:04:52 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:24:28 -0400
commitb9378fdbc334d1575b492108eac822a78c0c46d9 (patch)
tree9a78a121b72309a4471dee193ceefc5cb17ce520 /drivers
parent55c0d1005a0e5f590f71f918e49bdc81362f93a6 (diff)
V4L/DVB (5809): Use mutex instead of semaphore in Philips webcam driver
The Philips webcam driver 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: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/pwc/pwc-if.c12
-rw-r--r--drivers/media/video/pwc/pwc.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 085332a503de..9c0e8d18c2f6 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -1099,7 +1099,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1099 return -EBUSY; 1099 return -EBUSY;
1100 } 1100 }
1101 1101
1102 down(&pdev->modlock); 1102 mutex_lock(&pdev->modlock);
1103 if (!pdev->usb_init) { 1103 if (!pdev->usb_init) {
1104 PWC_DEBUG_OPEN("Doing first time initialization.\n"); 1104 PWC_DEBUG_OPEN("Doing first time initialization.\n");
1105 pdev->usb_init = 1; 1105 pdev->usb_init = 1;
@@ -1131,7 +1131,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1131 if (i < 0) { 1131 if (i < 0) {
1132 PWC_DEBUG_OPEN("Failed to allocate buffers memory.\n"); 1132 PWC_DEBUG_OPEN("Failed to allocate buffers memory.\n");
1133 pwc_free_buffers(pdev); 1133 pwc_free_buffers(pdev);
1134 up(&pdev->modlock); 1134 mutex_unlock(&pdev->modlock);
1135 return i; 1135 return i;
1136 } 1136 }
1137 1137
@@ -1172,7 +1172,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1172 if (i) { 1172 if (i) {
1173 PWC_DEBUG_OPEN("Second attempt at set_video_mode failed.\n"); 1173 PWC_DEBUG_OPEN("Second attempt at set_video_mode failed.\n");
1174 pwc_free_buffers(pdev); 1174 pwc_free_buffers(pdev);
1175 up(&pdev->modlock); 1175 mutex_unlock(&pdev->modlock);
1176 return i; 1176 return i;
1177 } 1177 }
1178 1178
@@ -1181,7 +1181,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1181 PWC_DEBUG_OPEN("Failed to init ISOC stuff = %d.\n", i); 1181 PWC_DEBUG_OPEN("Failed to init ISOC stuff = %d.\n", i);
1182 pwc_isoc_cleanup(pdev); 1182 pwc_isoc_cleanup(pdev);
1183 pwc_free_buffers(pdev); 1183 pwc_free_buffers(pdev);
1184 up(&pdev->modlock); 1184 mutex_unlock(&pdev->modlock);
1185 return i; 1185 return i;
1186 } 1186 }
1187 1187
@@ -1191,7 +1191,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1191 1191
1192 pdev->vopen++; 1192 pdev->vopen++;
1193 file->private_data = vdev; 1193 file->private_data = vdev;
1194 up(&pdev->modlock); 1194 mutex_unlock(&pdev->modlock);
1195 PWC_DEBUG_OPEN("<< video_open() returns 0.\n"); 1195 PWC_DEBUG_OPEN("<< video_open() returns 0.\n");
1196 return 0; 1196 return 0;
1197} 1197}
@@ -1685,7 +1685,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1685 pdev->angle_range.tilt_max = 2500; 1685 pdev->angle_range.tilt_max = 2500;
1686 } 1686 }
1687 1687
1688 init_MUTEX(&pdev->modlock); 1688 mutex_init(&pdev->modlock);
1689 spin_lock_init(&pdev->ptrlock); 1689 spin_lock_init(&pdev->ptrlock);
1690 1690
1691 pdev->udev = udev; 1691 pdev->udev = udev;
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index acbb9312960a..910a04f53920 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -31,7 +31,7 @@
31#include <linux/wait.h> 31#include <linux/wait.h>
32#include <linux/smp_lock.h> 32#include <linux/smp_lock.h>
33#include <linux/version.h> 33#include <linux/version.h>
34#include <asm/semaphore.h> 34#include <linux/mutex.h>
35#include <asm/errno.h> 35#include <asm/errno.h>
36#include <linux/videodev.h> 36#include <linux/videodev.h>
37#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
@@ -244,7 +244,7 @@ struct pwc_device
244 int image_read_pos; /* In case we read data in pieces, keep track of were we are in the imagebuffer */ 244 int image_read_pos; /* In case we read data in pieces, keep track of were we are in the imagebuffer */
245 int image_used[MAX_IMAGES]; /* For MCAPTURE and SYNC */ 245 int image_used[MAX_IMAGES]; /* For MCAPTURE and SYNC */
246 246
247 struct semaphore modlock; /* to prevent races in video_open(), etc */ 247 struct mutex modlock; /* to prevent races in video_open(), etc */
248 spinlock_t ptrlock; /* for manipulating the buffer pointers */ 248 spinlock_t ptrlock; /* for manipulating the buffer pointers */
249 249
250 /*** motorized pan/tilt feature */ 250 /*** motorized pan/tilt feature */