[media] staging: media: omap4iss: Cleanup media entities after unregistration
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 11 Dec 2014 13:23:57 +0000 (10:23 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 3 Apr 2015 00:17:04 +0000 (21:17 -0300)
The ipipeif, ipipe and resizer media entities are cleaned up before
unregistering the media device, creating a race condition. Fix it by
cleaning them up at cleanup time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/staging/media/omap4iss/iss_ipipe.c
drivers/staging/media/omap4iss/iss_ipipeif.c
drivers/staging/media/omap4iss/iss_resizer.c

index ff1d8cf3d284737b1eae2d2ae477e016d16e322f..eaa82da30f503a9f63ce17b0664b521dc88f31c2 100644 (file)
@@ -516,8 +516,6 @@ static int ipipe_init_entities(struct iss_ipipe_device *ipipe)
 
 void omap4iss_ipipe_unregister_entities(struct iss_ipipe_device *ipipe)
 {
-       media_entity_cleanup(&ipipe->subdev.entity);
-
        v4l2_device_unregister_subdev(&ipipe->subdev);
 }
 
@@ -566,5 +564,7 @@ int omap4iss_ipipe_init(struct iss_device *iss)
  */
 void omap4iss_ipipe_cleanup(struct iss_device *iss)
 {
-       /* FIXME: are you sure there's nothing to do? */
+       struct iss_ipipe_device *ipipe = &iss->ipipe;
+
+       media_entity_cleanup(&ipipe->subdev.entity);
 }
index 8000bd3bca343db725edd252f57dffa0915993a0..530ac8426b5bf5c931ace3f677271cf994055cd4 100644 (file)
@@ -771,8 +771,6 @@ static int ipipeif_init_entities(struct iss_ipipeif_device *ipipeif)
 
 void omap4iss_ipipeif_unregister_entities(struct iss_ipipeif_device *ipipeif)
 {
-       media_entity_cleanup(&ipipeif->subdev.entity);
-
        v4l2_device_unregister_subdev(&ipipeif->subdev);
        omap4iss_video_unregister(&ipipeif->video_out);
 }
@@ -826,5 +824,7 @@ int omap4iss_ipipeif_init(struct iss_device *iss)
  */
 void omap4iss_ipipeif_cleanup(struct iss_device *iss)
 {
-       /* FIXME: are you sure there's nothing to do? */
+       struct iss_ipipeif_device *ipipeif = &iss->ipipeif;
+
+       media_entity_cleanup(&ipipeif->subdev.entity);
 }
index ded9066c64d7c116eac0b1ea84935be834013fb5..5f69012c4debdda7b178a67e936b0bea6f59087d 100644 (file)
@@ -815,8 +815,6 @@ static int resizer_init_entities(struct iss_resizer_device *resizer)
 
 void omap4iss_resizer_unregister_entities(struct iss_resizer_device *resizer)
 {
-       media_entity_cleanup(&resizer->subdev.entity);
-
        v4l2_device_unregister_subdev(&resizer->subdev);
        omap4iss_video_unregister(&resizer->video_out);
 }
@@ -870,5 +868,7 @@ int omap4iss_resizer_init(struct iss_device *iss)
  */
 void omap4iss_resizer_cleanup(struct iss_device *iss)
 {
-       /* FIXME: are you sure there's nothing to do? */
+       struct iss_resizer_device *resizer = &iss->resizer;
+
+       media_entity_cleanup(&resizer->subdev.entity);
 }