From patchwork Wed Dec 26 17:35:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 1911241 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 E6926402E1 for ; Wed, 26 Dec 2012 17:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752426Ab2LZRgF (ORCPT ); Wed, 26 Dec 2012 12:36:05 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:51740 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752319Ab2LZRgB (ORCPT ); Wed, 26 Dec 2012 12:36:01 -0500 Received: from axis700.grange (dslb-178-001-136-130.pools.arcor-ip.net [178.1.136.130]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LfcCc-1TGSwP3y7m-00pIsd; Wed, 26 Dec 2012 18:36:00 +0100 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 624C040BDC for ; Wed, 26 Dec 2012 18:35:59 +0100 (CET) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1Tnutb-0001cX-1v for linux-media@vger.kernel.org; Wed, 26 Dec 2012 18:35:59 +0100 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Subject: [PATCH 6/6] soc-camera: fix repeated regulator requesting Date: Wed, 26 Dec 2012 18:35:58 +0100 Message-Id: <1356543358-6180-7-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1356543358-6180-1-git-send-email-g.liakhovetski@gmx.de> References: <1356543358-6180-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:lJbPEdeczYewTBJMEe1wf5exHmP67bJAFKUzIo/81B1 pTakTV6rcitHNkyiQyhrgi3cQF6tLBorJI6GRC0O8RRN+U3W5g kYimNKWyvvx1NQc/Wk/4ctn0SgeuBADwZdR8i70rvVJOV0Rt1V eBnlhm6/iY/+3KOyaJOW2xdwzNr3ekIAnHh2PXC1h1O9Xz2ZWD xMzMxjZL4pyCbH2Qe+9e5jT5iM3adRg1AYsjMgDgru/oVT7mW5 +peSMV4iVP2sZV/T8h/WoaDigLMsY0P0WUYHHU5zefjnkLraSX PYY1HWjzybs+2ahQNQwKkc1grnkRRc6aoCtNC1/iOOOdHqdQE+ PS8zBhpNUWUgSuvc0CRvwnDD38cUfBzsAQ2UnOqnw2bihNLa18 RZTjtHHlufiHQ== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/soc_camera/soc_camera.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 4285a8b..0b6ddff 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1146,11 +1146,6 @@ static int soc_camera_probe(struct soc_camera_device *icd) if (ret < 0) return ret; - ret = devm_regulator_bulk_get(icd->pdev, ssdd->num_regulators, - ssdd->regulators); - if (ret < 0) - goto ereg; - /* The camera could have been already on, try to reset */ if (ssdd->reset) ssdd->reset(icd->pdev); @@ -1255,7 +1250,6 @@ evdc: ici->ops->remove(icd); mutex_unlock(&ici->host_lock); eadd: -ereg: v4l2_ctrl_handler_free(&icd->ctrl_handler); return ret; } @@ -1542,7 +1536,9 @@ static int soc_camera_video_start(struct soc_camera_device *icd) static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) { struct soc_camera_desc *sdesc = pdev->dev.platform_data; + struct soc_camera_subdev_desc *ssdd = &sdesc->subdev_desc; struct soc_camera_device *icd; + int ret; if (!sdesc) return -EINVAL; @@ -1551,6 +1547,11 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) if (!icd) return -ENOMEM; + ret = devm_regulator_bulk_get(&pdev->dev, ssdd->num_regulators, + ssdd->regulators); + if (ret < 0) + return ret; + icd->iface = sdesc->host_desc.bus_id; icd->sdesc = sdesc; icd->pdev = &pdev->dev;