summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pxa_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-18 16:28:54 +0100
committerGuennadi Liakhovetski <g.liakhovetski@gmx.de>2008-12-18 16:28:54 +0100
commitffcb9d5faa4646d9cc1eb76d94fb97beb14e67d7 (patch)
tree3bfcbcfd42e70e69640e97cd77a07b9f7e95992d /linux/drivers/media/video/pxa_camera.c
parent7d538f92603bb1975760b0b9c0b215b8191e4f82 (diff)
downloadmediapointer-dvb-s2-ffcb9d5faa4646d9cc1eb76d94fb97beb14e67d7.tar.gz
mediapointer-dvb-s2-ffcb9d5faa4646d9cc1eb76d94fb97beb14e67d7.tar.bz2
soc-camera: unify locking, play nicer with videobuf locking
From: Guennadi Liakhovetski <lg@denx.de> Move mutex from host drivers to camera device object, take into account videobuf locking. Signed-off-by: Guennadi Liakhovetski <lg@denx.de> --- drivers/media/video/pxa_camera.c | 15 ++--- drivers/media/video/sh_mobile_ceu_camera.c | 9 +-- drivers/media/video/soc_camera.c | 99 +++++++++++++++++++++++----- include/media/soc_camera.h | 8 ++- 4 files changed, 96 insertions(+), 35 deletions(-)
Diffstat (limited to 'linux/drivers/media/video/pxa_camera.c')
-rw-r--r--linux/drivers/media/video/pxa_camera.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/linux/drivers/media/video/pxa_camera.c b/linux/drivers/media/video/pxa_camera.c
index cec1a5a21..484d474b3 100644
--- a/linux/drivers/media/video/pxa_camera.c
+++ b/linux/drivers/media/video/pxa_camera.c
@@ -25,7 +25,6 @@
#include <linux/version.h>
#include <linux/device.h>
#include <linux/platform_device.h>
-#include <linux/mutex.h>
#include <linux/clk.h>
#include <media/v4l2-common.h>
@@ -169,8 +168,6 @@
CICR0_PERRM | CICR0_QDM | CICR0_CDM | CICR0_SOFM | \
CICR0_EOFM | CICR0_FOM)
-static DEFINE_MUTEX(camera_lock);
-
/*
* Structures
*/
@@ -818,16 +815,17 @@ static irqreturn_t pxa_camera_irq(int irq, void *data)
return IRQ_HANDLED;
}
-/* The following two functions absolutely depend on the fact, that
- * there can be only one camera on PXA quick capture interface */
+/*
+ * The following two functions absolutely depend on the fact, that
+ * there can be only one camera on PXA quick capture interface
+ * Called with .video_lock held
+ */
static int pxa_camera_add_device(struct soc_camera_device *icd)
{
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
struct pxa_camera_dev *pcdev = ici->priv;
int ret;
- mutex_lock(&camera_lock);
-
if (pcdev->icd) {
ret = -EBUSY;
goto ebusy;
@@ -843,11 +841,10 @@ static int pxa_camera_add_device(struct soc_camera_device *icd)
pcdev->icd = icd;
ebusy:
- mutex_unlock(&camera_lock);
-
return ret;
}
+/* Called with .video_lock held */
static void pxa_camera_remove_device(struct soc_camera_device *icd)
{
struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);