]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[media] omap3isp: Move media_entity_cleanup() from unregister() to cleanup()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 22 Sep 2011 19:54:34 +0000 (16:54 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 3 Nov 2011 20:29:15 +0000 (18:29 -0200)
The media_entity_cleanup() function belong to the module cleanup
handlers, not the entity registration handlers. Move it there.

Create a omap3isp_video_cleanup() function to cleanup the video node
entity, and call it from the module cleanup handlers.

Rename omap3isp_stat_free() to omap3isp_stat_cleanup().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
12 files changed:
drivers/media/video/omap3isp/ispccdc.c
drivers/media/video/omap3isp/ispccp2.c
drivers/media/video/omap3isp/ispcsi2.c
drivers/media/video/omap3isp/isph3a_aewb.c
drivers/media/video/omap3isp/isph3a_af.c
drivers/media/video/omap3isp/isphist.c
drivers/media/video/omap3isp/isppreview.c
drivers/media/video/omap3isp/ispresizer.c
drivers/media/video/omap3isp/ispstat.c
drivers/media/video/omap3isp/ispstat.h
drivers/media/video/omap3isp/ispvideo.c
drivers/media/video/omap3isp/ispvideo.h

index 253fdcce2df29c33ececf6ea76abd280a104d33b..98804d5f89c2dbc3535fc7f9e4e3a0d122aa43a6 100644 (file)
@@ -2206,8 +2206,6 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
 
 void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc)
 {
-       media_entity_cleanup(&ccdc->subdev.entity);
-
        v4l2_device_unregister_subdev(&ccdc->subdev);
        omap3isp_video_unregister(&ccdc->video_out);
 }
@@ -2287,6 +2285,9 @@ void omap3isp_ccdc_cleanup(struct isp_device *isp)
 {
        struct isp_ccdc_device *ccdc = &isp->isp_ccdc;
 
+       omap3isp_video_cleanup(&ccdc->video_out);
+       media_entity_cleanup(&ccdc->subdev.entity);
+
        /* Free LSC requests. As the CCDC is stopped there's no active request,
         * so only the pending request and the free queue need to be handled.
         */
index fa1d09b0ad9891eba70467969e6327c190a7dd7a..b8e0863b194c6c369ca075ca79775b1f9d62b825 100644 (file)
@@ -1100,8 +1100,6 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
  */
 void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2)
 {
-       media_entity_cleanup(&ccp2->subdev.entity);
-
        v4l2_device_unregister_subdev(&ccp2->subdev);
        omap3isp_video_unregister(&ccp2->video_in);
 }
@@ -1146,6 +1144,9 @@ void omap3isp_ccp2_cleanup(struct isp_device *isp)
 {
        struct isp_ccp2_device *ccp2 = &isp->isp_ccp2;
 
+       omap3isp_video_cleanup(&ccp2->video_in);
+       media_entity_cleanup(&ccp2->subdev.entity);
+
        regulator_put(ccp2->vdds_csib);
 }
 
index 69161a682b3d18158cb0a0e6507fd080f8fa56b9..5612e95ac0b81ea9e0ddd49f3206062af1833ccf 100644 (file)
@@ -1241,8 +1241,6 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
 
 void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2)
 {
-       media_entity_cleanup(&csi2->subdev.entity);
-
        v4l2_device_unregister_subdev(&csi2->subdev);
        omap3isp_video_unregister(&csi2->video_out);
 }
@@ -1277,6 +1275,10 @@ error:
  */
 void omap3isp_csi2_cleanup(struct isp_device *isp)
 {
+       struct isp_csi2_device *csi2a = &isp->isp_csi2a;
+
+       omap3isp_video_cleanup(&csi2a->video_out);
+       media_entity_cleanup(&csi2a->subdev.entity);
 }
 
 /*
index 8068cefd8d89cb01ae5cc5e291cdcae92ffbd916..a3c76bf1817585997ebe7dcad9bcdbe3c7345aa1 100644 (file)
@@ -370,5 +370,5 @@ void omap3isp_h3a_aewb_cleanup(struct isp_device *isp)
 {
        kfree(isp->isp_aewb.priv);
        kfree(isp->isp_aewb.recover_priv);
-       omap3isp_stat_free(&isp->isp_aewb);
+       omap3isp_stat_cleanup(&isp->isp_aewb);
 }
index ba54d0acdecf11037ff433d9481d84e65ee62eee..58e0bc41489971a16d47e0afcf6722fc318687dd 100644 (file)
@@ -425,5 +425,5 @@ void omap3isp_h3a_af_cleanup(struct isp_device *isp)
 {
        kfree(isp->isp_af.priv);
        kfree(isp->isp_af.recover_priv);
-       omap3isp_stat_free(&isp->isp_af);
+       omap3isp_stat_cleanup(&isp->isp_af);
 }
index 1743856b30d166a3782b70fb548cde2c925146b7..1163907bcddcb17fcdbb3fb8070d697f0842dc98 100644 (file)
@@ -516,5 +516,5 @@ void omap3isp_hist_cleanup(struct isp_device *isp)
        if (HIST_USING_DMA(&isp->isp_hist))
                omap_free_dma(isp->isp_hist.dma_ch);
        kfree(isp->isp_hist.priv);
-       omap3isp_stat_free(&isp->isp_hist);
+       omap3isp_stat_cleanup(&isp->isp_hist);
 }
index aba537af87e43fec1109c5d2dfada0ac88464eca..84a18b66b23c4093711fc95e1aac97cb47e83779 100644 (file)
@@ -2046,10 +2046,7 @@ static int preview_init_entities(struct isp_prev_device *prev)
 
 void omap3isp_preview_unregister_entities(struct isp_prev_device *prev)
 {
-       media_entity_cleanup(&prev->subdev.entity);
-
        v4l2_device_unregister_subdev(&prev->subdev);
-       v4l2_ctrl_handler_free(&prev->ctrls);
        omap3isp_video_unregister(&prev->video_in);
        omap3isp_video_unregister(&prev->video_out);
 }
@@ -2085,6 +2082,12 @@ error:
 
 void omap3isp_preview_cleanup(struct isp_device *isp)
 {
+       struct isp_prev_device *prev = &isp->isp_prev;
+
+       v4l2_ctrl_handler_free(&prev->ctrls);
+       omap3isp_video_cleanup(&prev->video_in);
+       omap3isp_video_cleanup(&prev->video_out);
+       media_entity_cleanup(&prev->subdev.entity);
 }
 
 /*
index 0bb0f8cd36f51c312979719b1515b8b52f029929..78ce0406a2329274cdb00ef9a2cc0ec4f55be9fa 100644 (file)
@@ -1674,8 +1674,6 @@ static int resizer_init_entities(struct isp_res_device *res)
 
 void omap3isp_resizer_unregister_entities(struct isp_res_device *res)
 {
-       media_entity_cleanup(&res->subdev.entity);
-
        v4l2_device_unregister_subdev(&res->subdev);
        omap3isp_video_unregister(&res->video_in);
        omap3isp_video_unregister(&res->video_out);
@@ -1712,6 +1710,11 @@ error:
 
 void omap3isp_resizer_cleanup(struct isp_device *isp)
 {
+       struct isp_res_device *res = &isp->isp_res;
+
+       omap3isp_video_cleanup(&res->video_in);
+       omap3isp_video_cleanup(&res->video_out);
+       media_entity_cleanup(&res->subdev.entity);
 }
 
 /*
index 732905552261af9d27a020fe2e61cf015ddbb301..bf0e5a771857b9823a9a56cfe911f6aaaf90cc70 100644 (file)
@@ -1062,7 +1062,6 @@ int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
 
 void omap3isp_stat_unregister_entities(struct ispstat *stat)
 {
-       media_entity_cleanup(&stat->subdev.entity);
        v4l2_device_unregister_subdev(&stat->subdev);
 }
 
@@ -1085,8 +1084,9 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name,
        return isp_stat_init_entities(stat, name, sd_ops);
 }
 
-void omap3isp_stat_free(struct ispstat *stat)
+void omap3isp_stat_cleanup(struct ispstat *stat)
 {
+       media_entity_cleanup(&stat->subdev.entity);
        isp_stat_bufs_free(stat);
        kfree(stat->buf);
 }
index d86da94fa50dcb292e7c4899de498767ad954237..9b7c8654dc8a4cadea05dd1ff629ad35b8ebae85 100644 (file)
@@ -144,7 +144,7 @@ int omap3isp_stat_request_statistics(struct ispstat *stat,
                                     struct omap3isp_stat_data *data);
 int omap3isp_stat_init(struct ispstat *stat, const char *name,
                       const struct v4l2_subdev_ops *sd_ops);
-void omap3isp_stat_free(struct ispstat *stat);
+void omap3isp_stat_cleanup(struct ispstat *stat);
 int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
                                  struct v4l2_fh *fh,
                                  struct v4l2_event_subscription *sub);
index 0cb8a9f9d675ddbd9e460b2a8143ea81fb47a105..7d74ebbdb63bda386bfb49c8e52fa22f625cf91b 100644 (file)
@@ -1325,6 +1325,11 @@ int omap3isp_video_init(struct isp_video *video, const char *name)
        return 0;
 }
 
+void omap3isp_video_cleanup(struct isp_video *video)
+{
+       media_entity_cleanup(&video->video.entity);
+}
+
 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
 {
        int ret;
@@ -1341,8 +1346,6 @@ int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
 
 void omap3isp_video_unregister(struct isp_video *video)
 {
-       if (video_is_registered(&video->video)) {
-               media_entity_cleanup(&video->video.entity);
+       if (video_is_registered(&video->video))
                video_unregister_device(&video->video);
-       }
 }
index 53160aa24e6ed0d39c9a2b6c6c52b997c1179864..08cbfa144e6e4f1a7beb1baa2a2dc2571a5b6d71 100644 (file)
@@ -190,6 +190,7 @@ struct isp_video_fh {
                                container_of(q, struct isp_video_fh, queue)
 
 int omap3isp_video_init(struct isp_video *video, const char *name);
+void omap3isp_video_cleanup(struct isp_video *video);
 int omap3isp_video_register(struct isp_video *video,
                            struct v4l2_device *vdev);
 void omap3isp_video_unregister(struct isp_video *video);