summaryrefslogtreecommitdiff
path: root/drivers/media/platform/soc_camera/soc_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-01-03 11:21:02 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-01-05 01:35:54 -0200
commit8a97d4c11756ab6bab8582126d0f1b5c00b067ad (patch)
treeb8f5043edc341af33c67c886cf050db5ee362311 /drivers/media/platform/soc_camera/soc_camera.c
parent7d051b35d5196ad6011a17e751dbd3d180abb046 (diff)
[media] soc-camera: fix repeated regulator requesting
Currently devm_regulator_bulk_get() is called by soc-camera during host driver probing, but regulators are attached to the camera platform device, that is staying, independent whether the host probed successfully or not. This can lead to repeated regulator requesting, if the host driver is re-probed. Move the call to platform device probing to avoid this. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/soc_camera/soc_camera.c')
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 1070a0c496d8..6552856ea59b 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1149,11 +1149,6 @@ static int soc_camera_probe(struct soc_camera_device *icd)
if (ret < 0)
return ret;
- ret = devm_regulator_bulk_get(icd->pdev, icl->num_regulators,
- icl->regulators);
- if (ret < 0)
- goto ereg;
-
/* The camera could have been already on, try to reset */
if (icl->reset)
icl->reset(icd->pdev);
@@ -1260,7 +1255,6 @@ evdc:
ici->ops->remove(icd);
mutex_unlock(&ici->host_lock);
eadd:
-ereg:
v4l2_ctrl_handler_free(&icd->ctrl_handler);
return ret;
}
@@ -1549,6 +1543,7 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev)
{
struct soc_camera_link *icl = pdev->dev.platform_data;
struct soc_camera_device *icd;
+ int ret;
if (!icl)
return -EINVAL;
@@ -1557,6 +1552,11 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev)
if (!icd)
return -ENOMEM;
+ ret = devm_regulator_bulk_get(&pdev->dev, icl->num_regulators,
+ icl->regulators);
+ if (ret < 0)
+ return ret;
+
icd->iface = icl->bus_id;
icd->link = icl;
icd->pdev = &pdev->dev;