From patchwork Thu Jul 5 20:38:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1162221 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DDC863FE4F for ; Thu, 5 Jul 2012 20:39:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757182Ab2GEUi5 (ORCPT ); Thu, 5 Jul 2012 16:38:57 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:60437 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754030Ab2GEUir (ORCPT ); Thu, 5 Jul 2012 16:38:47 -0400 Received: from avalon.ideasonboard.com (unknown [91.178.211.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 64DDC7B0D; Thu, 5 Jul 2012 22:38:44 +0200 (CEST) From: Laurent Pinchart To: Guennadi Liakhovetski Cc: linux-media@vger.kernel.org Subject: [PATCH v2 7/9] soc-camera: Continue the power off sequence if one of the steps fails Date: Thu, 5 Jul 2012 22:38:46 +0200 Message-Id: <1341520728-2707-8-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1341520728-2707-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1341520728-2707-1-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/video/soc_camera.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 55b981f..bbd518f 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -89,18 +89,15 @@ 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; - if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) - return ret; + v4l2_subdev_call(sd, core, s_power, 0); if (icl->power) { ret = icl->power(icd->control, 0); - if (ret < 0) { + if (ret < 0) dev_err(icd->pdev, "Platform failed to power-off the camera.\n"); - return ret; - } } ret = regulator_bulk_disable(icl->num_regulators,