aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 16f595d4337a..9f5ae8167855 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -237,11 +237,11 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd)
237 return -ENOMEM; 237 return -ENOMEM;
238 238
239 icd->num_user_formats = fmts; 239 icd->num_user_formats = fmts;
240 fmts = 0;
241 240
242 dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); 241 dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts);
243 242
244 /* Second pass - actually fill data formats */ 243 /* Second pass - actually fill data formats */
244 fmts = 0;
245 for (i = 0; i < icd->num_formats; i++) 245 for (i = 0; i < icd->num_formats; i++)
246 if (!ici->ops->get_formats) { 246 if (!ici->ops->get_formats) {
247 icd->user_formats[i].host_fmt = icd->formats + i; 247 icd->user_formats[i].host_fmt = icd->formats + i;
@@ -877,8 +877,11 @@ static int soc_camera_probe(struct device *dev)
877 (unsigned short)~0; 877 (unsigned short)~0;
878 878
879 ret = soc_camera_init_user_formats(icd); 879 ret = soc_camera_init_user_formats(icd);
880 if (ret < 0) 880 if (ret < 0) {
881 if (icd->ops->remove)
882 icd->ops->remove(icd);
881 goto eiufmt; 883 goto eiufmt;
884 }
882 885
883 icd->height = DEFAULT_HEIGHT; 886 icd->height = DEFAULT_HEIGHT;
884 icd->width = DEFAULT_WIDTH; 887 icd->width = DEFAULT_WIDTH;
@@ -902,8 +905,10 @@ static int soc_camera_remove(struct device *dev)
902{ 905{
903 struct soc_camera_device *icd = to_soc_camera_dev(dev); 906 struct soc_camera_device *icd = to_soc_camera_dev(dev);
904 907
908 mutex_lock(&icd->video_lock);
905 if (icd->ops->remove) 909 if (icd->ops->remove)
906 icd->ops->remove(icd); 910 icd->ops->remove(icd);
911 mutex_unlock(&icd->video_lock);
907 912
908 soc_camera_free_user_formats(icd); 913 soc_camera_free_user_formats(icd);
909 914
@@ -1145,6 +1150,7 @@ evidallocd:
1145} 1150}
1146EXPORT_SYMBOL(soc_camera_video_start); 1151EXPORT_SYMBOL(soc_camera_video_start);
1147 1152
1153/* Called from client .remove() methods with .video_lock held */
1148void soc_camera_video_stop(struct soc_camera_device *icd) 1154void soc_camera_video_stop(struct soc_camera_device *icd)
1149{ 1155{
1150 struct video_device *vdev = icd->vdev; 1156 struct video_device *vdev = icd->vdev;
@@ -1154,10 +1160,8 @@ void soc_camera_video_stop(struct soc_camera_device *icd)
1154 if (!icd->dev.parent || !vdev) 1160 if (!icd->dev.parent || !vdev)
1155 return; 1161 return;
1156 1162
1157 mutex_lock(&icd->video_lock);
1158 video_unregister_device(vdev); 1163 video_unregister_device(vdev);
1159 icd->vdev = NULL; 1164 icd->vdev = NULL;
1160 mutex_unlock(&icd->video_lock);
1161} 1165}
1162EXPORT_SYMBOL(soc_camera_video_stop); 1166EXPORT_SYMBOL(soc_camera_video_stop);
1163 1167