From patchwork Mon Nov 12 04:43:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 12805 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 71B2723EFB for ; Mon, 12 Nov 2012 04:43:28 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 049D1A18A0C for ; Mon, 12 Nov 2012 04:43:27 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so4015057iag.11 for ; Sun, 11 Nov 2012 20:43:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:message-id :date:from:user-agent:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=Roja8pLs6PeTm+NLlbS6oP9h2u3itFX3aHBuuGqIkFU=; b=cjNTjXo3OyX8qEYYrpBw32zBE3WehvNXLuQtKb4cI2ezECKU2egV87VRnMf0vSuDXD xI+u0Rnd1g9kTxrzdtlplneeupG+o8feHnry6U+h59w91kON/lex4JxjnV9wCQVRMqJh IgSj56ua3i5li19g6tx1fQJoOAJoPgwSrf32/Ly3T8kAhF9QHAWIUSyfo4TYsuzpM95H Npdd7U1vqvu8wO0hbKPeogw0RCKIF2lC2MEars33GTYDNUcA7REq5ISdCSfeQ/NyvRyC 6GVr02h07Ymg7yNJsCYgfmEQUM8QgDXZqQGYaucNEJQiE6/3fmA6GEnMBK2488t7NTfm xXGQ== Received: by 10.50.140.97 with SMTP id rf1mr6788110igb.70.1352695407463; Sun, 11 Nov 2012 20:43:27 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp314018igt; Sun, 11 Nov 2012 20:43:27 -0800 (PST) Received: by 10.68.231.3 with SMTP id tc3mr54246558pbc.89.1352695406839; Sun, 11 Nov 2012 20:43:26 -0800 (PST) Received: from mail-da0-f48.google.com (mail-da0-f48.google.com [209.85.210.48]) by mx.google.com with ESMTPS id m5si7965557paw.281.2012.11.11.20.43.26 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Nov 2012 20:43:26 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.48 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) client-ip=209.85.210.48; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.48 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) smtp.mail=tushar.behera@linaro.org Received: by mail-da0-f48.google.com with SMTP id z8so2592145dad.35 for ; Sun, 11 Nov 2012 20:43:26 -0800 (PST) Received: by 10.66.84.163 with SMTP id a3mr45925671paz.2.1352695406492; Sun, 11 Nov 2012 20:43:26 -0800 (PST) Received: from [10.10.10.29] ([115.113.119.130]) by mx.google.com with ESMTPS id bc8sm3642311pab.5.2012.11.11.20.43.23 (version=SSLv3 cipher=OTHER); Sun, 11 Nov 2012 20:43:25 -0800 (PST) Message-ID: <50A07E8B.20902@linaro.org> Date: Mon, 12 Nov 2012 10:13:55 +0530 From: Tushar Behera User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: Mark Brown CC: linux-kernel@vger.kernel.org, philipspatches@gmail.com, patches@linaro.org Subject: Re: [PATCH] regulator: core: Update regulator_is_supported_voltage for fixed voltages References: <1352458309-18141-1-git-send-email-tushar.behera@linaro.org> <20121109170918.GW23807@opensource.wolfsonmicro.com> In-Reply-To: <20121109170918.GW23807@opensource.wolfsonmicro.com> X-Gm-Message-State: ALoCoQlFTq4JaCFTbZKGCKctnkcjXoLT6431FqHthsaHC2K449GJLc/UCv1AorRPGWkFJsMFn6Da On 11/09/2012 10:39 PM, Mark Brown wrote: > On Fri, Nov 09, 2012 at 04:21:49PM +0530, Tushar Behera wrote: > >> In case of fixed regulators for which voltage cannot be changed, >> regulator_is_supported_voltage should return success only if the >> min_uV and max_uV parameters are same and it is equal to the current >> voltage of the regulator. > > This makes no sense to me at all. The caller is asking if it's possible > to set the voltage between the minimum and maximum values, any voltage > in that range should be OK. Your patch makes the function massively > less useful. > Ok. In that case, we should modify the test condition as following. Currently it passes success when the regulator voltage is less than both min_uV and max_uV. If ok, I will send another patch for this. return ret; } diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 1a35251..e90e5c3 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1974,7 +1974,7 @@ int regulator_is_supported_voltage(struct regulator *regulator, if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { ret = regulator_get_voltage(regulator); if (ret >= 0) - return (min_uV >= ret && ret <= max_uV); + return (ret >= min_uV && ret <= max_uV); else