[PATCH 08/14] media: soc-camera: use managed devm_regulator_bulk_get()

Guennadi Liakhovetski g.liakhovetski at gmx.de
Fri Sep 28 00:07:27 EST 2012


Using device-managed devm_regulator_bulk_get() eliminates the need to
release regulators explicitly.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski at gmx.de>
---
 drivers/media/platform/soc_camera/soc_camera.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 997be15..c2a5fa3 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1249,7 +1249,6 @@ static int soc_camera_i2c_notify(struct notifier_block *nb,
 		video_device_release(icd->vdev);
 		icd->vdev = NULL;
 	}
-	regulator_bulk_free(icl->num_regulators, icl->regulators);
 	v4l2_ctrl_handler_free(&icd->ctrl_handler);
 
 	return NOTIFY_DONE;
@@ -1358,8 +1357,8 @@ static int soc_camera_probe(struct soc_camera_device *icd)
 	if (ret < 0)
 		return ret;
 
-	ret = regulator_bulk_get(icd->pdev, icl->num_regulators,
-				 icl->regulators);
+	ret = devm_regulator_bulk_get(icd->pdev, icl->num_regulators,
+				      icl->regulators);
 	if (ret < 0)
 		goto ereg;
 
@@ -1423,7 +1422,6 @@ eadddev:
 		icd->vdev = NULL;
 	}
 evdc:
-	regulator_bulk_free(icl->num_regulators, icl->regulators);
 ereg:
 	v4l2_ctrl_handler_free(&icd->ctrl_handler);
 	return ret;
@@ -1460,8 +1458,6 @@ static int soc_camera_remove(struct soc_camera_device *icd)
 	}
 	soc_camera_free_user_formats(icd);
 
-	regulator_bulk_free(icl->num_regulators, icl->regulators);
-
 	return 0;
 }
 
-- 
1.7.2.5



More information about the devicetree-discuss mailing list