From patchwork Thu Apr 13 18:03:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104404 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp829942qgf; Thu, 13 Apr 2017 11:03:36 -0700 (PDT) X-Received: by 10.36.120.82 with SMTP id p79mr5635178itc.59.1492106616895; Thu, 13 Apr 2017 11:03:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r85si16226780ioe.110.2017.04.13.11.03.36; Thu, 13 Apr 2017 11:03:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755289AbdDMSDb (ORCPT + 15 others); Thu, 13 Apr 2017 14:03:31 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:46446 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbdDMSD0 (ORCPT ); Thu, 13 Apr 2017 14:03:26 -0400 Received: from [2001:470:1f1d:6b5::3] (helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cyj5V-0002PP-QV; Thu, 13 Apr 2017 18:03:24 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1cyj5S-0000Av-Pl; Thu, 13 Apr 2017 19:03:18 +0100 From: Mark Brown To: Dong Aisheng Cc: linux-kernel@vger.kernel.org, Mark Brown Date: Thu, 13 Apr 2017 19:03:15 +0100 Message-Id: <20170413180316.617-1-broonie@kernel.org> X-Mailer: git-send-email 2.11.0 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: [PATCH 1/2] regulator: core: Only propagate voltage changes to if it can change voltages X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we are propagating voltage changes to parent regulators don't bother if the parent does not have permission to change voltages. This simplifies error checking in the function for cases where the regulator lacks some of the voltage operations. Reported-by: Dong Aisheng Signed-off-by: Mark Brown --- Untested. drivers/regulator/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 82205cc5daa7..2b464a286451 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2959,8 +2959,10 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator, if (ret < 0) goto out2; - if (rdev->supply && (rdev->desc->min_dropout_uV || - !rdev->desc->ops->get_voltage)) { + if (rdev->supply && + regulator_ops_is_valid(rdev->supply->rdev, + REGULATOR_CHANGE_VOLTAGE) && + (rdev->desc->min_dropout_uV || !rdev->desc->ops->get_voltage)) { int current_supply_uV; int selector; From patchwork Thu Apr 13 18:03:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104403 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp830136qgf; Thu, 13 Apr 2017 11:04:02 -0700 (PDT) X-Received: by 10.36.240.9 with SMTP id s9mr5014500ith.45.1492106642491; Thu, 13 Apr 2017 11:04:02 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 186si9687608itk.52.2017.04.13.11.04.02; Thu, 13 Apr 2017 11:04:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755228AbdDMSD3 (ORCPT + 15 others); Thu, 13 Apr 2017 14:03:29 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:46452 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752890AbdDMSD0 (ORCPT ); Thu, 13 Apr 2017 14:03:26 -0400 Received: from [2001:470:1f1d:6b5::3] (helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cyj5W-0002PS-L9; Thu, 13 Apr 2017 18:03:24 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1cyj5T-0000B1-To; Thu, 13 Apr 2017 19:03:19 +0100 From: Mark Brown To: Dong Aisheng Cc: linux-kernel@vger.kernel.org, Mark Brown Date: Thu, 13 Apr 2017 19:03:16 +0100 Message-Id: <20170413180316.617-2-broonie@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170413180316.617-1-broonie@kernel.org> References: <20170413180316.617-1-broonie@kernel.org> X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: [PATCH 2/2] regulator: core: Allow dummy regulators for supplies X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rather than just not resolving the supply when there is explicitly no supply mapping fall through and allow a dummy supply to be substituted. Signed-off-by: Mark Brown --- drivers/regulator/core.c | 8 -------- 1 file changed, 8 deletions(-) -- 2.11.0 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 2b464a286451..047ada74aa4a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1533,14 +1533,6 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) if (IS_ERR(r)) { ret = PTR_ERR(r); - if (ret == -ENODEV) { - /* - * No supply was specified for this regulator and - * there will never be one. - */ - return 0; - } - /* Did the lookup explicitly defer for us? */ if (ret == -EPROBE_DEFER) return ret;