aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-22 15:54:34 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:29:15 -0400
commit63b4ca23ed2b35742bebf8cb2af49b84b24442c6 (patch)
tree19bcdc500eabdab107a570916cdc890cd3e39b29 /drivers/media
parent57f6217be1d129e3e38bac3eadc20cbf909666b6 (diff)
[media] omap3isp: Move media_entity_cleanup() from unregister() to cleanup()
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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c5
-rw-r--r--drivers/media/video/omap3isp/ispccp2.c5
-rw-r--r--drivers/media/video/omap3isp/ispcsi2.c6
-rw-r--r--drivers/media/video/omap3isp/isph3a_aewb.c2
-rw-r--r--drivers/media/video/omap3isp/isph3a_af.c2
-rw-r--r--drivers/media/video/omap3isp/isphist.c2
-rw-r--r--drivers/media/video/omap3isp/isppreview.c9
-rw-r--r--drivers/media/video/omap3isp/ispresizer.c7
-rw-r--r--drivers/media/video/omap3isp/ispstat.c4
-rw-r--r--drivers/media/video/omap3isp/ispstat.h2
-rw-r--r--drivers/media/video/omap3isp/ispvideo.c9
-rw-r--r--drivers/media/video/omap3isp/ispvideo.h1
12 files changed, 34 insertions, 20 deletions
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index 253fdcce2df2..98804d5f89c2 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -2206,8 +2206,6 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
2206 2206
2207void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc) 2207void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc)
2208{ 2208{
2209 media_entity_cleanup(&ccdc->subdev.entity);
2210
2211 v4l2_device_unregister_subdev(&ccdc->subdev); 2209 v4l2_device_unregister_subdev(&ccdc->subdev);
2212 omap3isp_video_unregister(&ccdc->video_out); 2210 omap3isp_video_unregister(&ccdc->video_out);
2213} 2211}
@@ -2287,6 +2285,9 @@ void omap3isp_ccdc_cleanup(struct isp_device *isp)
2287{ 2285{
2288 struct isp_ccdc_device *ccdc = &isp->isp_ccdc; 2286 struct isp_ccdc_device *ccdc = &isp->isp_ccdc;
2289 2287
2288 omap3isp_video_cleanup(&ccdc->video_out);
2289 media_entity_cleanup(&ccdc->subdev.entity);
2290
2290 /* Free LSC requests. As the CCDC is stopped there's no active request, 2291 /* Free LSC requests. As the CCDC is stopped there's no active request,
2291 * so only the pending request and the free queue need to be handled. 2292 * so only the pending request and the free queue need to be handled.
2292 */ 2293 */
diff --git a/drivers/media/video/omap3isp/ispccp2.c b/drivers/media/video/omap3isp/ispccp2.c
index fa1d09b0ad98..b8e0863b194c 100644
--- a/drivers/media/video/omap3isp/ispccp2.c
+++ b/drivers/media/video/omap3isp/ispccp2.c
@@ -1100,8 +1100,6 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
1100 */ 1100 */
1101void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2) 1101void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2)
1102{ 1102{
1103 media_entity_cleanup(&ccp2->subdev.entity);
1104
1105 v4l2_device_unregister_subdev(&ccp2->subdev); 1103 v4l2_device_unregister_subdev(&ccp2->subdev);
1106 omap3isp_video_unregister(&ccp2->video_in); 1104 omap3isp_video_unregister(&ccp2->video_in);
1107} 1105}
@@ -1146,6 +1144,9 @@ void omap3isp_ccp2_cleanup(struct isp_device *isp)
1146{ 1144{
1147 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; 1145 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2;
1148 1146
1147 omap3isp_video_cleanup(&ccp2->video_in);
1148 media_entity_cleanup(&ccp2->subdev.entity);
1149
1149 regulator_put(ccp2->vdds_csib); 1150 regulator_put(ccp2->vdds_csib);
1150} 1151}
1151 1152
diff --git a/drivers/media/video/omap3isp/ispcsi2.c b/drivers/media/video/omap3isp/ispcsi2.c
index 69161a682b3d..5612e95ac0b8 100644
--- a/drivers/media/video/omap3isp/ispcsi2.c
+++ b/drivers/media/video/omap3isp/ispcsi2.c
@@ -1241,8 +1241,6 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
1241 1241
1242void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2) 1242void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2)
1243{ 1243{
1244 media_entity_cleanup(&csi2->subdev.entity);
1245
1246 v4l2_device_unregister_subdev(&csi2->subdev); 1244 v4l2_device_unregister_subdev(&csi2->subdev);
1247 omap3isp_video_unregister(&csi2->video_out); 1245 omap3isp_video_unregister(&csi2->video_out);
1248} 1246}
@@ -1277,6 +1275,10 @@ error:
1277 */ 1275 */
1278void omap3isp_csi2_cleanup(struct isp_device *isp) 1276void omap3isp_csi2_cleanup(struct isp_device *isp)
1279{ 1277{
1278 struct isp_csi2_device *csi2a = &isp->isp_csi2a;
1279
1280 omap3isp_video_cleanup(&csi2a->video_out);
1281 media_entity_cleanup(&csi2a->subdev.entity);
1280} 1282}
1281 1283
1282/* 1284/*
diff --git a/drivers/media/video/omap3isp/isph3a_aewb.c b/drivers/media/video/omap3isp/isph3a_aewb.c
index 8068cefd8d89..a3c76bf18175 100644
--- a/drivers/media/video/omap3isp/isph3a_aewb.c
+++ b/drivers/media/video/omap3isp/isph3a_aewb.c
@@ -370,5 +370,5 @@ void omap3isp_h3a_aewb_cleanup(struct isp_device *isp)
370{ 370{
371 kfree(isp->isp_aewb.priv); 371 kfree(isp->isp_aewb.priv);
372 kfree(isp->isp_aewb.recover_priv); 372 kfree(isp->isp_aewb.recover_priv);
373 omap3isp_stat_free(&isp->isp_aewb); 373 omap3isp_stat_cleanup(&isp->isp_aewb);
374} 374}
diff --git a/drivers/media/video/omap3isp/isph3a_af.c b/drivers/media/video/omap3isp/isph3a_af.c
index ba54d0acdecf..58e0bc414899 100644
--- a/drivers/media/video/omap3isp/isph3a_af.c
+++ b/drivers/media/video/omap3isp/isph3a_af.c
@@ -425,5 +425,5 @@ void omap3isp_h3a_af_cleanup(struct isp_device *isp)
425{ 425{
426 kfree(isp->isp_af.priv); 426 kfree(isp->isp_af.priv);
427 kfree(isp->isp_af.recover_priv); 427 kfree(isp->isp_af.recover_priv);
428 omap3isp_stat_free(&isp->isp_af); 428 omap3isp_stat_cleanup(&isp->isp_af);
429} 429}
diff --git a/drivers/media/video/omap3isp/isphist.c b/drivers/media/video/omap3isp/isphist.c
index 1743856b30d1..1163907bcddc 100644
--- a/drivers/media/video/omap3isp/isphist.c
+++ b/drivers/media/video/omap3isp/isphist.c
@@ -516,5 +516,5 @@ void omap3isp_hist_cleanup(struct isp_device *isp)
516 if (HIST_USING_DMA(&isp->isp_hist)) 516 if (HIST_USING_DMA(&isp->isp_hist))
517 omap_free_dma(isp->isp_hist.dma_ch); 517 omap_free_dma(isp->isp_hist.dma_ch);
518 kfree(isp->isp_hist.priv); 518 kfree(isp->isp_hist.priv);
519 omap3isp_stat_free(&isp->isp_hist); 519 omap3isp_stat_cleanup(&isp->isp_hist);
520} 520}
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c
index aba537af87e4..84a18b66b23c 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -2046,10 +2046,7 @@ static int preview_init_entities(struct isp_prev_device *prev)
2046 2046
2047void omap3isp_preview_unregister_entities(struct isp_prev_device *prev) 2047void omap3isp_preview_unregister_entities(struct isp_prev_device *prev)
2048{ 2048{
2049 media_entity_cleanup(&prev->subdev.entity);
2050
2051 v4l2_device_unregister_subdev(&prev->subdev); 2049 v4l2_device_unregister_subdev(&prev->subdev);
2052 v4l2_ctrl_handler_free(&prev->ctrls);
2053 omap3isp_video_unregister(&prev->video_in); 2050 omap3isp_video_unregister(&prev->video_in);
2054 omap3isp_video_unregister(&prev->video_out); 2051 omap3isp_video_unregister(&prev->video_out);
2055} 2052}
@@ -2085,6 +2082,12 @@ error:
2085 2082
2086void omap3isp_preview_cleanup(struct isp_device *isp) 2083void omap3isp_preview_cleanup(struct isp_device *isp)
2087{ 2084{
2085 struct isp_prev_device *prev = &isp->isp_prev;
2086
2087 v4l2_ctrl_handler_free(&prev->ctrls);
2088 omap3isp_video_cleanup(&prev->video_in);
2089 omap3isp_video_cleanup(&prev->video_out);
2090 media_entity_cleanup(&prev->subdev.entity);
2088} 2091}
2089 2092
2090/* 2093/*
diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c
index 0bb0f8cd36f5..78ce0406a232 100644
--- a/drivers/media/video/omap3isp/ispresizer.c
+++ b/drivers/media/video/omap3isp/ispresizer.c
@@ -1674,8 +1674,6 @@ static int resizer_init_entities(struct isp_res_device *res)
1674 1674
1675void omap3isp_resizer_unregister_entities(struct isp_res_device *res) 1675void omap3isp_resizer_unregister_entities(struct isp_res_device *res)
1676{ 1676{
1677 media_entity_cleanup(&res->subdev.entity);
1678
1679 v4l2_device_unregister_subdev(&res->subdev); 1677 v4l2_device_unregister_subdev(&res->subdev);
1680 omap3isp_video_unregister(&res->video_in); 1678 omap3isp_video_unregister(&res->video_in);
1681 omap3isp_video_unregister(&res->video_out); 1679 omap3isp_video_unregister(&res->video_out);
@@ -1712,6 +1710,11 @@ error:
1712 1710
1713void omap3isp_resizer_cleanup(struct isp_device *isp) 1711void omap3isp_resizer_cleanup(struct isp_device *isp)
1714{ 1712{
1713 struct isp_res_device *res = &isp->isp_res;
1714
1715 omap3isp_video_cleanup(&res->video_in);
1716 omap3isp_video_cleanup(&res->video_out);
1717 media_entity_cleanup(&res->subdev.entity);
1715} 1718}
1716 1719
1717/* 1720/*
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c
index 732905552261..bf0e5a771857 100644
--- a/drivers/media/video/omap3isp/ispstat.c
+++ b/drivers/media/video/omap3isp/ispstat.c
@@ -1062,7 +1062,6 @@ int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
1062 1062
1063void omap3isp_stat_unregister_entities(struct ispstat *stat) 1063void omap3isp_stat_unregister_entities(struct ispstat *stat)
1064{ 1064{
1065 media_entity_cleanup(&stat->subdev.entity);
1066 v4l2_device_unregister_subdev(&stat->subdev); 1065 v4l2_device_unregister_subdev(&stat->subdev);
1067} 1066}
1068 1067
@@ -1085,8 +1084,9 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name,
1085 return isp_stat_init_entities(stat, name, sd_ops); 1084 return isp_stat_init_entities(stat, name, sd_ops);
1086} 1085}
1087 1086
1088void omap3isp_stat_free(struct ispstat *stat) 1087void omap3isp_stat_cleanup(struct ispstat *stat)
1089{ 1088{
1089 media_entity_cleanup(&stat->subdev.entity);
1090 isp_stat_bufs_free(stat); 1090 isp_stat_bufs_free(stat);
1091 kfree(stat->buf); 1091 kfree(stat->buf);
1092} 1092}
diff --git a/drivers/media/video/omap3isp/ispstat.h b/drivers/media/video/omap3isp/ispstat.h
index d86da94fa50d..9b7c8654dc8a 100644
--- a/drivers/media/video/omap3isp/ispstat.h
+++ b/drivers/media/video/omap3isp/ispstat.h
@@ -144,7 +144,7 @@ int omap3isp_stat_request_statistics(struct ispstat *stat,
144 struct omap3isp_stat_data *data); 144 struct omap3isp_stat_data *data);
145int omap3isp_stat_init(struct ispstat *stat, const char *name, 145int omap3isp_stat_init(struct ispstat *stat, const char *name,
146 const struct v4l2_subdev_ops *sd_ops); 146 const struct v4l2_subdev_ops *sd_ops);
147void omap3isp_stat_free(struct ispstat *stat); 147void omap3isp_stat_cleanup(struct ispstat *stat);
148int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, 148int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
149 struct v4l2_fh *fh, 149 struct v4l2_fh *fh,
150 struct v4l2_event_subscription *sub); 150 struct v4l2_event_subscription *sub);
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c
index 0cb8a9f9d675..7d74ebbdb63b 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -1325,6 +1325,11 @@ int omap3isp_video_init(struct isp_video *video, const char *name)
1325 return 0; 1325 return 0;
1326} 1326}
1327 1327
1328void omap3isp_video_cleanup(struct isp_video *video)
1329{
1330 media_entity_cleanup(&video->video.entity);
1331}
1332
1328int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) 1333int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
1329{ 1334{
1330 int ret; 1335 int ret;
@@ -1341,8 +1346,6 @@ int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
1341 1346
1342void omap3isp_video_unregister(struct isp_video *video) 1347void omap3isp_video_unregister(struct isp_video *video)
1343{ 1348{
1344 if (video_is_registered(&video->video)) { 1349 if (video_is_registered(&video->video))
1345 media_entity_cleanup(&video->video.entity);
1346 video_unregister_device(&video->video); 1350 video_unregister_device(&video->video);
1347 }
1348} 1351}
diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h
index 53160aa24e6e..08cbfa144e6e 100644
--- a/drivers/media/video/omap3isp/ispvideo.h
+++ b/drivers/media/video/omap3isp/ispvideo.h
@@ -190,6 +190,7 @@ struct isp_video_fh {
190 container_of(q, struct isp_video_fh, queue) 190 container_of(q, struct isp_video_fh, queue)
191 191
192int omap3isp_video_init(struct isp_video *video, const char *name); 192int omap3isp_video_init(struct isp_video *video, const char *name);
193void omap3isp_video_cleanup(struct isp_video *video);
193int omap3isp_video_register(struct isp_video *video, 194int omap3isp_video_register(struct isp_video *video,
194 struct v4l2_device *vdev); 195 struct v4l2_device *vdev);
195void omap3isp_video_unregister(struct isp_video *video); 196void omap3isp_video_unregister(struct isp_video *video);