summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-07-05 19:08:55 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-07-05 19:08:55 -0300
commit784f927dcf2cc497d4a2c44fb4f1321d9cf0c45b (patch)
treefaa5f190e79e79c18b4d56c6fa643e6f251e4563 /linux/drivers/media/video/soc_camera.c
parent33059960a17b83a720e88a4093d4fc40a1a307a4 (diff)
parent59ad1e534e569f743df108421f369cbf915f2e6e (diff)
downloadmediapointer-dvb-s2-784f927dcf2cc497d4a2c44fb4f1321d9cf0c45b.tar.gz
mediapointer-dvb-s2-784f927dcf2cc497d4a2c44fb4f1321d9cf0c45b.tar.bz2
merge: http://linuxtv.org/hg/~awalls/ivtv
From: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/soc_camera.c')
-rw-r--r--linux/drivers/media/video/soc_camera.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c
index e4056a9c2..4f315c1b7 100644
--- a/linux/drivers/media/video/soc_camera.c
+++ b/linux/drivers/media/video/soc_camera.c
@@ -238,11 +238,11 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd)
return -ENOMEM;
icd->num_user_formats = fmts;
- fmts = 0;
dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts);
/* Second pass - actually fill data formats */
+ fmts = 0;
for (i = 0; i < icd->num_formats; i++)
if (!ici->ops->get_formats) {
icd->user_formats[i].host_fmt = icd->formats + i;
@@ -878,8 +878,11 @@ static int soc_camera_probe(struct device *dev)
(unsigned short)~0;
ret = soc_camera_init_user_formats(icd);
- if (ret < 0)
+ if (ret < 0) {
+ if (icd->ops->remove)
+ icd->ops->remove(icd);
goto eiufmt;
+ }
icd->height = DEFAULT_HEIGHT;
icd->width = DEFAULT_WIDTH;
@@ -903,8 +906,10 @@ static int soc_camera_remove(struct device *dev)
{
struct soc_camera_device *icd = to_soc_camera_dev(dev);
+ mutex_lock(&icd->video_lock);
if (icd->ops->remove)
icd->ops->remove(icd);
+ mutex_unlock(&icd->video_lock);
soc_camera_free_user_formats(icd);
@@ -1146,6 +1151,7 @@ evidallocd:
}
EXPORT_SYMBOL(soc_camera_video_start);
+/* Called from client .remove() methods with .video_lock held */
void soc_camera_video_stop(struct soc_camera_device *icd)
{
struct video_device *vdev = icd->vdev;
@@ -1155,10 +1161,8 @@ void soc_camera_video_stop(struct soc_camera_device *icd)
if (!icd->dev.parent || !vdev)
return;
- mutex_lock(&icd->video_lock);
video_unregister_device(vdev);
icd->vdev = NULL;
- mutex_unlock(&icd->video_lock);
}
EXPORT_SYMBOL(soc_camera_video_stop);