Skip to content

Commit

Permalink
[media] omap3isp: Move *_init_entities() functions to the init/cleanu…
Browse files Browse the repository at this point in the history
…p 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>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Nov 3, 2011
1 parent 63b4ca2 commit 39099d0
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 239 deletions.
62 changes: 31 additions & 31 deletions drivers/media/video/omap3isp/ispccdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,37 @@ static const struct media_entity_operations ccdc_media_ops = {
.link_setup = ccdc_link_setup,
};

void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc)
{
v4l2_device_unregister_subdev(&ccdc->subdev);
omap3isp_video_unregister(&ccdc->video_out);
}

int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc,
struct v4l2_device *vdev)
{
int ret;

/* Register the subdev and video node. */
ret = v4l2_device_register_subdev(vdev, &ccdc->subdev);
if (ret < 0)
goto error;

ret = omap3isp_video_register(&ccdc->video_out, vdev);
if (ret < 0)
goto error;

return 0;

error:
omap3isp_ccdc_unregister_entities(ccdc);
return ret;
}

/* -----------------------------------------------------------------------------
* ISP CCDC initialisation and cleanup
*/

/*
* ccdc_init_entities - Initialize V4L2 subdev and media entity
* @ccdc: ISP CCDC module
Expand Down Expand Up @@ -2204,37 +2235,6 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
return 0;
}

void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc)
{
v4l2_device_unregister_subdev(&ccdc->subdev);
omap3isp_video_unregister(&ccdc->video_out);
}

int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc,
struct v4l2_device *vdev)
{
int ret;

/* Register the subdev and video node. */
ret = v4l2_device_register_subdev(vdev, &ccdc->subdev);
if (ret < 0)
goto error;

ret = omap3isp_video_register(&ccdc->video_out, vdev);
if (ret < 0)
goto error;

return 0;

error:
omap3isp_ccdc_unregister_entities(ccdc);
return ret;
}

/* -----------------------------------------------------------------------------
* ISP CCDC initialisation and cleanup
*/

/*
* omap3isp_ccdc_init - CCDC module initialization.
* @dev: Device pointer specific to the OMAP3 ISP.
Expand Down
112 changes: 56 additions & 56 deletions drivers/media/video/omap3isp/ispccp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,48 @@ static const struct media_entity_operations ccp2_media_ops = {
.link_setup = ccp2_link_setup,
};

/*
* omap3isp_ccp2_unregister_entities - Unregister media entities: subdev
* @ccp2: Pointer to ISP CCP2 device
*/
void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2)
{
v4l2_device_unregister_subdev(&ccp2->subdev);
omap3isp_video_unregister(&ccp2->video_in);
}

/*
* omap3isp_ccp2_register_entities - Register the subdev media entity
* @ccp2: Pointer to ISP CCP2 device
* @vdev: Pointer to v4l device
* return negative error code or zero on success
*/

int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2,
struct v4l2_device *vdev)
{
int ret;

/* Register the subdev and video nodes. */
ret = v4l2_device_register_subdev(vdev, &ccp2->subdev);
if (ret < 0)
goto error;

ret = omap3isp_video_register(&ccp2->video_in, vdev);
if (ret < 0)
goto error;

return 0;

error:
omap3isp_ccp2_unregister_entities(ccp2);
return ret;
}

/* -----------------------------------------------------------------------------
* ISP ccp2 initialisation and cleanup
*/

/*
* ccp2_init_entities - Initialize ccp2 subdev and media entity.
* @ccp2: Pointer to ISP CCP2 device
Expand Down Expand Up @@ -1094,62 +1136,6 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
return 0;
}

/*
* omap3isp_ccp2_unregister_entities - Unregister media entities: subdev
* @ccp2: Pointer to ISP CCP2 device
*/
void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2)
{
v4l2_device_unregister_subdev(&ccp2->subdev);
omap3isp_video_unregister(&ccp2->video_in);
}

/*
* omap3isp_ccp2_register_entities - Register the subdev media entity
* @ccp2: Pointer to ISP CCP2 device
* @vdev: Pointer to v4l device
* return negative error code or zero on success
*/

int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2,
struct v4l2_device *vdev)
{
int ret;

/* Register the subdev and video nodes. */
ret = v4l2_device_register_subdev(vdev, &ccp2->subdev);
if (ret < 0)
goto error;

ret = omap3isp_video_register(&ccp2->video_in, vdev);
if (ret < 0)
goto error;

return 0;

error:
omap3isp_ccp2_unregister_entities(ccp2);
return ret;
}

/* -----------------------------------------------------------------------------
* ISP ccp2 initialisation and cleanup
*/

/*
* omap3isp_ccp2_cleanup - CCP2 un-initialization
* @isp : Pointer to ISP device
*/
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);
}

/*
* omap3isp_ccp2_init - CCP2 initialization.
* @isp : Pointer to ISP device
Expand Down Expand Up @@ -1195,3 +1181,17 @@ int omap3isp_ccp2_init(struct isp_device *isp)

return ret;
}

/*
* omap3isp_ccp2_cleanup - CCP2 un-initialization
* @isp : Pointer to ISP device
*/
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);
}
84 changes: 42 additions & 42 deletions drivers/media/video/omap3isp/ispcsi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,37 @@ static const struct media_entity_operations csi2_media_ops = {
.link_setup = csi2_link_setup,
};

void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2)
{
v4l2_device_unregister_subdev(&csi2->subdev);
omap3isp_video_unregister(&csi2->video_out);
}

int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
struct v4l2_device *vdev)
{
int ret;

/* Register the subdev and video nodes. */
ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
if (ret < 0)
goto error;

ret = omap3isp_video_register(&csi2->video_out, vdev);
if (ret < 0)
goto error;

return 0;

error:
omap3isp_csi2_unregister_entities(csi2);
return ret;
}

/* -----------------------------------------------------------------------------
* ISP CSI2 initialisation and cleanup
*/

/*
* csi2_init_entities - Initialize subdev and media entity.
* @csi2: Pointer to csi2 structure.
Expand Down Expand Up @@ -1239,48 +1270,6 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
return 0;
}

void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2)
{
v4l2_device_unregister_subdev(&csi2->subdev);
omap3isp_video_unregister(&csi2->video_out);
}

int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
struct v4l2_device *vdev)
{
int ret;

/* Register the subdev and video nodes. */
ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
if (ret < 0)
goto error;

ret = omap3isp_video_register(&csi2->video_out, vdev);
if (ret < 0)
goto error;

return 0;

error:
omap3isp_csi2_unregister_entities(csi2);
return ret;
}

/* -----------------------------------------------------------------------------
* ISP CSI2 initialisation and cleanup
*/

/*
* omap3isp_csi2_cleanup - Routine for module driver cleanup
*/
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);
}

/*
* omap3isp_csi2_init - Routine for module driver init
*/
Expand Down Expand Up @@ -1317,3 +1306,14 @@ int omap3isp_csi2_init(struct isp_device *isp)
omap3isp_csi2_cleanup(isp);
return ret;
}

/*
* omap3isp_csi2_cleanup - Routine for module driver cleanup
*/
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);
}
Loading

0 comments on commit 39099d0

Please sign in to comment.