diff options
author | Guennadi Liakhovetski <lg@denx.de> | 2008-12-18 10:28:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:40:22 -0500 |
commit | 1c3bb7431d16f7486a8523d54380bad89c485dc8 (patch) | |
tree | 89dd8e65f627df726e70de771130398ba73148b3 /drivers/media/video/pxa_camera.c | |
parent | bf507158eb27ea94aca300b28ecee60fdbb40007 (diff) |
V4L/DVB (10083): soc-camera: unify locking, play nicer with videobuf locking
Move mutex from host drivers to camera device object, take into account
videobuf locking.
Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pxa_camera.c')
-rw-r--r-- | drivers/media/video/pxa_camera.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index aa7efc45d364..c3c50de0aa50 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/version.h> | 25 | #include <linux/version.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/mutex.h> | ||
29 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
30 | 29 | ||
31 | #include <media/v4l2-common.h> | 30 | #include <media/v4l2-common.h> |
@@ -164,8 +163,6 @@ | |||
164 | CICR0_PERRM | CICR0_QDM | CICR0_CDM | CICR0_SOFM | \ | 163 | CICR0_PERRM | CICR0_QDM | CICR0_CDM | CICR0_SOFM | \ |
165 | CICR0_EOFM | CICR0_FOM) | 164 | CICR0_EOFM | CICR0_FOM) |
166 | 165 | ||
167 | static DEFINE_MUTEX(camera_lock); | ||
168 | |||
169 | /* | 166 | /* |
170 | * Structures | 167 | * Structures |
171 | */ | 168 | */ |
@@ -813,16 +810,17 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) | |||
813 | return IRQ_HANDLED; | 810 | return IRQ_HANDLED; |
814 | } | 811 | } |
815 | 812 | ||
816 | /* The following two functions absolutely depend on the fact, that | 813 | /* |
817 | * there can be only one camera on PXA quick capture interface */ | 814 | * The following two functions absolutely depend on the fact, that |
815 | * there can be only one camera on PXA quick capture interface | ||
816 | * Called with .video_lock held | ||
817 | */ | ||
818 | static int pxa_camera_add_device(struct soc_camera_device *icd) | 818 | static int pxa_camera_add_device(struct soc_camera_device *icd) |
819 | { | 819 | { |
820 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 820 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
821 | struct pxa_camera_dev *pcdev = ici->priv; | 821 | struct pxa_camera_dev *pcdev = ici->priv; |
822 | int ret; | 822 | int ret; |
823 | 823 | ||
824 | mutex_lock(&camera_lock); | ||
825 | |||
826 | if (pcdev->icd) { | 824 | if (pcdev->icd) { |
827 | ret = -EBUSY; | 825 | ret = -EBUSY; |
828 | goto ebusy; | 826 | goto ebusy; |
@@ -838,11 +836,10 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) | |||
838 | pcdev->icd = icd; | 836 | pcdev->icd = icd; |
839 | 837 | ||
840 | ebusy: | 838 | ebusy: |
841 | mutex_unlock(&camera_lock); | ||
842 | |||
843 | return ret; | 839 | return ret; |
844 | } | 840 | } |
845 | 841 | ||
842 | /* Called with .video_lock held */ | ||
846 | static void pxa_camera_remove_device(struct soc_camera_device *icd) | 843 | static void pxa_camera_remove_device(struct soc_camera_device *icd) |
847 | { | 844 | { |
848 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 845 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |