diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-07-18 15:54:02 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-15 21:54:53 +0200 |
commit | 24592adce89805c99eb23d1e37aa8a66aaacee05 (patch) | |
tree | bf178d38e2c0581a605f58a07ddb9f1c2faf5452 /drivers | |
parent | [media] soc_camera: Don't call .s_power() during probe (diff) | |
download | linux-24592adce89805c99eb23d1e37aa8a66aaacee05.tar.xz linux-24592adce89805c99eb23d1e37aa8a66aaacee05.zip |
[media] soc-camera: Continue the power off sequence if one of the steps fails
Powering off a device is a "best effort" task: failure to execute one of
the steps should not prevent the next steps to be executed. For
instance, an I2C communication error when putting the chip in stand-by
mode should not prevent the more agressive next step of turning the
chip's power supply off.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/platform/soc_camera.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/media/platform/soc_camera.c b/drivers/media/platform/soc_camera.c index a6d484f38a88..3feb43b4f281 100644 --- a/drivers/media/platform/soc_camera.c +++ b/drivers/media/platform/soc_camera.c @@ -89,24 +89,30 @@ static int soc_camera_power_off(struct soc_camera_device *icd, struct soc_camera_link *icl) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - int ret = v4l2_subdev_call(sd, core, s_power, 0); + int ret = 0; + int err; - if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) - return ret; + err = v4l2_subdev_call(sd, core, s_power, 0); + if (err < 0 && err != -ENOIOCTLCMD && err != -ENODEV) { + dev_err(icd->pdev, "Subdev failed to power-off the camera.\n"); + ret = err; + } if (icl->power) { - ret = icl->power(icd->control, 0); - if (ret < 0) { + err = icl->power(icd->control, 0); + if (err < 0) { dev_err(icd->pdev, "Platform failed to power-off the camera.\n"); - return ret; + ret = ret ? : err; } } - ret = regulator_bulk_disable(icl->num_regulators, + err = regulator_bulk_disable(icl->num_regulators, icl->regulators); - if (ret < 0) + if (err < 0) { dev_err(icd->pdev, "Cannot disable regulators\n"); + ret = ret ? : err; + } return ret; } |