Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4863422ooa; Tue, 14 Aug 2018 11:36:29 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzHWfMkpbDzlciMCM7tOb9+W3Egkeh1ylEnI503Lr/MDAGfM1VRlwkKDJ36azZRVP6GgiwC X-Received: by 2002:a63:8b44:: with SMTP id j65-v6mr22347515pge.248.1534271789815; Tue, 14 Aug 2018 11:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534271789; cv=none; d=google.com; s=arc-20160816; b=eZqEq7NDsp5ztdR7yPCmHjKobsn1xg6wFRNYqL59Q1BiJgMIm9+aCV2ksmiRCT+1Ga lBMY3YzpJqu3pdMH8UPfnQCIHuCurogZ05SvamOc+hpOGQ9ICxQsMrG7Lzv+j2vXaKWj B9a2kfjIRAuIoLk8C4m2a/5f0Fq7+IElvEYJPQMA370bmaAz8jakDf7Uh4YRm6UsNoN/ Wrk2u1nF49Yfkm4qLADYpbGBp3P+2XC0gh17ckPO/9BME66f2i0nwWGiYA+zEtItl3bV YPYDcn6pHnVv1T9pO2BglQY8R70pdPYyVuN98/JhjsSesz9tgXjP0wCff7RHm/0uTEhv WCVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=0H1tmyUa/QOjOvfTrRyA42bq10a9t8mlNbWvDQjrHro=; b=C1disZvz+Z+BEthNAtUQnCOiswT4VZMQw7RDc6tM9ybjsQ9+KfaB5AVafzDmKLENHh V/LBWmm4v0SnVHHDOrSt9pU9PbmNHNK6xy3BGVHEbun+JaBusUG5wArLuaHFTLXIXZlT 2FfykJzWiRKoAhIDBzJPlZvFL2uJo2R5gwe1ryjFJdIVRNTQ6q6ruRsD6O+4kM12qLa2 NMH/kfH5RdgXJh9gX3gWLU4tgYCTCRMdrUiuuZ1z1C3QnWWWVQrRYBZqGh92XjEsUoS0 lSQPm8C3/xL368Z0lpYdCRHIvHIchENNHwK+RMhw5SJyUud4xJWDO3/sKMZQkmyx/J9g louQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=VCakmkiA; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q2jugY11; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24-v6si17198085pls.353.2018.08.14.11.36.15; Tue, 14 Aug 2018 11:36:29 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=VCakmkiA; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q2jugY11; 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 S1728618AbeHNVTC (ORCPT + 99 others); Tue, 14 Aug 2018 17:19:02 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33848 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727948AbeHNVTC (ORCPT ); Tue, 14 Aug 2018 17:19:02 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 453E460710; Tue, 14 Aug 2018 18:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534271436; bh=+MKoJfAKL95nPnPbxaYFQaksmkgEX2WLcfVbx92Iayw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=VCakmkiAfExRk1/C028msYEa2R8PvhGxFwjnejZV2UJHvwgvseC0RcnV/0I3BdJZO yDe58yEArbMF86Hcokjo5S5LX9H/2YV+2uPS3wdwMfdN1h4HWFEQB+0mfDoXZhAo/0 6aAkR2okOO33GqsdM0DJEgPoCvv/weWH4thtCnYw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.46.160.165] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: collinsd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 358C0600C1; Tue, 14 Aug 2018 18:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534271435; bh=+MKoJfAKL95nPnPbxaYFQaksmkgEX2WLcfVbx92Iayw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Q2jugY11peWAT0XwxZ7/IbpbPyOpIKK+W/gLB+e38r0gCbc2WitVgIk+xURQSQiAb nJBnkBoFRh2ngUIViDh16APuotvXv/RKv6ndDgNyjzU5LbVHGZVnamsF7swoyf4FQ1 6aQx3vNsnFyRgjSw6vqOOM2GOInCUlItXfVayQQM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 358C0600C1 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=collinsd@codeaurora.org Subject: Re: [PATCH 1/4] regulator: core: If consumers don't call regulator_set_load() assume max To: Douglas Anderson , broonie@kernel.org Cc: linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, swboyd@chromium.org, Liam Girdwood , linux-kernel@vger.kernel.org References: <20180814170617.100087-1-dianders@chromium.org> <20180814170617.100087-2-dianders@chromium.org> From: David Collins Message-ID: Date: Tue, 14 Aug 2018 11:30:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20180814170617.100087-2-dianders@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Doug, On 08/14/2018 10:06 AM, Douglas Anderson wrote: > Not all regulator consumers call regulator_set_load(). On some > regulators (like on RPMh-regulator) this could be bad since the > regulator framework will treat this as if consumer needs no load. > It's much better to assume that a dumb client needs the maximum > possible load so we get correctness first. > > Signed-off-by: Douglas Anderson > --- The behavior introduced by this patch seems like an undesirable hack to me. It goes against the general philosophy within the regulator framework of taking no action unless directed to do so by an explicit consumer request (or special device tree property). We should assume that consumers make requests to meet their needs instead of assuming that they are missing important votes required by their hardware. > drivers/regulator/core.c | 10 +++++++++- > drivers/regulator/internal.h | 1 + > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c > index 6ed568b96c0e..a4da68775b49 100644 > --- a/drivers/regulator/core.c > +++ b/drivers/regulator/core.c > @@ -732,6 +732,7 @@ static int drms_uA_update(struct regulator_dev *rdev) > struct regulator *sibling; > int current_uA = 0, output_uV, input_uV, err; > unsigned int mode; > + bool any_unset = false; > > lockdep_assert_held_once(&rdev->mutex); > > @@ -751,11 +752,17 @@ static int drms_uA_update(struct regulator_dev *rdev) > return -EINVAL; > > /* calc total requested load */ > - list_for_each_entry(sibling, &rdev->consumer_list, list) > + list_for_each_entry(sibling, &rdev->consumer_list, list) { > current_uA += sibling->uA_load; > + if (!sibling->uA_load_set) > + any_unset = true; > + } > > current_uA += rdev->constraints->system_load; > > + if (any_unset) > + current_uA = INT_MAX; > + This check will incorrectly result in a constant load request of INT_MAX for all regulators that have at least one child regulator. This is the case because such child regulators are present in rdev->consumer_list and because regulator_set_load() requests are not propagated up to parent regulators. Thus, the regulator structs for child regulators will always have uA_load==0 and uA_load_set==false. Take care, David -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project