aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/omap3isp/isppreview.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-22 15:59:26 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:29:16 -0400
commit39099d09ae4605003696919d7c3a6e8a96607c4b (patch)
treef89d402db0ad2f54c02b58f0ce698f6aafbd679a /drivers/media/video/omap3isp/isppreview.c
parent63b4ca23ed2b35742bebf8cb2af49b84b24442c6 (diff)
[media] omap3isp: Move *_init_entities() functions to the init/cleanup section
Group all init/cleanup functions together to make the code more readable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/omap3isp/isppreview.c')
-rw-r--r--drivers/media/video/omap3isp/isppreview.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c
index 84a18b66b23c..b926ebbaca3a 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -1966,8 +1966,44 @@ static const struct media_entity_operations preview_media_ops = {
1966 .link_setup = preview_link_setup, 1966 .link_setup = preview_link_setup,
1967}; 1967};
1968 1968
1969void omap3isp_preview_unregister_entities(struct isp_prev_device *prev)
1970{
1971 v4l2_device_unregister_subdev(&prev->subdev);
1972 omap3isp_video_unregister(&prev->video_in);
1973 omap3isp_video_unregister(&prev->video_out);
1974}
1975
1976int omap3isp_preview_register_entities(struct isp_prev_device *prev,
1977 struct v4l2_device *vdev)
1978{
1979 int ret;
1980
1981 /* Register the subdev and video nodes. */
1982 ret = v4l2_device_register_subdev(vdev, &prev->subdev);
1983 if (ret < 0)
1984 goto error;
1985
1986 ret = omap3isp_video_register(&prev->video_in, vdev);
1987 if (ret < 0)
1988 goto error;
1989
1990 ret = omap3isp_video_register(&prev->video_out, vdev);
1991 if (ret < 0)
1992 goto error;
1993
1994 return 0;
1995
1996error:
1997 omap3isp_preview_unregister_entities(prev);
1998 return ret;
1999}
2000
2001/* -----------------------------------------------------------------------------
2002 * ISP previewer initialisation and cleanup
2003 */
2004
1969/* 2005/*
1970 * review_init_entities - Initialize subdev and media entity. 2006 * preview_init_entities - Initialize subdev and media entity.
1971 * @prev : Pointer to preview structure 2007 * @prev : Pointer to preview structure
1972 * return -ENOMEM or zero on success 2008 * return -ENOMEM or zero on success
1973 */ 2009 */
@@ -2044,52 +2080,6 @@ static int preview_init_entities(struct isp_prev_device *prev)
2044 return 0; 2080 return 0;
2045} 2081}
2046 2082
2047void omap3isp_preview_unregister_entities(struct isp_prev_device *prev)
2048{
2049 v4l2_device_unregister_subdev(&prev->subdev);
2050 omap3isp_video_unregister(&prev->video_in);
2051 omap3isp_video_unregister(&prev->video_out);
2052}
2053
2054int omap3isp_preview_register_entities(struct isp_prev_device *prev,
2055 struct v4l2_device *vdev)
2056{
2057 int ret;
2058
2059 /* Register the subdev and video nodes. */
2060 ret = v4l2_device_register_subdev(vdev, &prev->subdev);
2061 if (ret < 0)
2062 goto error;
2063
2064 ret = omap3isp_video_register(&prev->video_in, vdev);
2065 if (ret < 0)
2066 goto error;
2067
2068 ret = omap3isp_video_register(&prev->video_out, vdev);
2069 if (ret < 0)
2070 goto error;
2071
2072 return 0;
2073
2074error:
2075 omap3isp_preview_unregister_entities(prev);
2076 return ret;
2077}
2078
2079/* -----------------------------------------------------------------------------
2080 * ISP previewer initialisation and cleanup
2081 */
2082
2083void omap3isp_preview_cleanup(struct isp_device *isp)
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);
2091}
2092
2093/* 2083/*
2094 * isp_preview_init - Previewer initialization. 2084 * isp_preview_init - Previewer initialization.
2095 * @dev : Pointer to ISP device 2085 * @dev : Pointer to ISP device
@@ -2114,3 +2104,13 @@ out:
2114 2104
2115 return ret; 2105 return ret;
2116} 2106}
2107
2108void omap3isp_preview_cleanup(struct isp_device *isp)
2109{
2110 struct isp_prev_device *prev = &isp->isp_prev;
2111
2112 v4l2_ctrl_handler_free(&prev->ctrls);
2113 omap3isp_video_cleanup(&prev->video_in);
2114 omap3isp_video_cleanup(&prev->video_out);
2115 media_entity_cleanup(&prev->subdev.entity);
2116}