From patchwork Tue Jan 3 06:09:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laxman Dewangan X-Patchwork-Id: 133978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 286E7B6FA5 for ; Tue, 3 Jan 2012 17:11:39 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750985Ab2ACGLi (ORCPT ); Tue, 3 Jan 2012 01:11:38 -0500 Received: from hqemgate03.nvidia.com ([216.228.121.140]:17648 "EHLO hqemgate03.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750879Ab2ACGLh (ORCPT ); Tue, 3 Jan 2012 01:11:37 -0500 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate03.nvidia.com id ; Mon, 02 Jan 2012 22:25:17 -0800 Received: from hqnvemgw02.nvidia.com ([172.17.108.22]) by hqnvupgp08.nvidia.com (PGP Universal service); Mon, 02 Jan 2012 22:11:36 -0800 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 02 Jan 2012 22:11:36 -0800 Received: from thelma.nvidia.com (Not Verified[172.16.212.77]) by hqnvemgw02.nvidia.com with MailMarshal (v6, 7, 2, 8378) id ; Mon, 02 Jan 2012 22:11:36 -0800 Received: from ldewangan-ubuntu.nvidia.com ([10.19.65.30]) by thelma.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id q036BX45027173; Mon, 2 Jan 2012 22:11:34 -0800 (PST) From: Laxman Dewangan To: broonie@opensource.wolfsonmicro.com, lrg@ti.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, ldewangan@nvidia.com Subject: [PATCH] regulator: Rail is said to be enable only if this and supply rails are enabled. Date: Tue, 3 Jan 2012 11:39:43 +0530 Message-Id: <1325570983-3700-1-git-send-email-ldewangan@nvidia.com> X-Mailer: git-send-email 1.7.1.1 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Laxman Dewangan The given rail is said to be enabled only if this rail is eanbled along with supply rail. Adding check for the supply rail whether it is enabled or not when query about rail enabled. Signed-off-by: Laxman Dewangan --- When consumer of any rails query about whether rail is enabled or not, the function regulator_is_enabled() should return enabled only if this rail and supply rail (both) are enabled. if any one of rail, whether the given rail or supply rail, is enabled then function should return as not enabled. drivers/regulator/core.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index dbdebed..d914435 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1701,6 +1701,12 @@ int regulator_is_enabled(struct regulator *regulator) { int ret; + if (regulator->rdev->supply) { + ret = regulator_is_enabled(regulator->rdev->supply); + if (ret <= 0) + return ret; + } + mutex_lock(®ulator->rdev->mutex); ret = _regulator_is_enabled(regulator->rdev); mutex_unlock(®ulator->rdev->mutex);