Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5224313pxu; Tue, 22 Dec 2020 11:19:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJydxAuvqF1Vle6844p2dWnjn0SIFPIpdVB5JTHpYPMSfb7vjISVZwNWU2QDNGZOyJLIBE9V X-Received: by 2002:a05:6402:1646:: with SMTP id s6mr21626027edx.319.1608664757483; Tue, 22 Dec 2020 11:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608664757; cv=none; d=google.com; s=arc-20160816; b=oOcL1B+xGVA6QmbpLPHkSKhNsoqDVLU3uIcCaVMCCi/P/y0BIRLf9PP+a6lM1sIJUp aB4MeLpZm1HUaUhs6iHFBFQFo4he/P3MxRES/Z1ss9xDfvzTvXiMZ/+Uk/Mrr0IHxEwQ GyKx2d2rVVxnTJEt4RuFtyk+mUnPKuhQVvzyPHvY/6tctrwABa2KE4PE6E5x63TXrZMj WKJkZiR9mWsePA3WqOARJfXmz6ElHEfOTBMqnGrwEypEVEvmpMVGdNHGupwAGWjxWUIV NfUXSqft7FYfVMTS6m4QoJrHnGnAbq6xR0/nf5L6VSKhRezDN+ksCtYRHjWyMQoh+nU6 SFCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=uAS0dihWy6acCqxpttIdhhTtHB8s/0UZpEYGm2Afc0A=; b=B8uqmm/QLTxei8Gq3j3gWIbc/gcfKxpF+xeioWvNH1jMUDIg14+CcIopar4a/pSsoG YmUcy53sF+TSEYOcFLePPU11Wm9gDdCYI2d8hI7jyiC+ZcobPcIYYAW33L2+p04InjHi BEq7iQe2DtHnTGzDgEACUedSLgKtXjG63Pe+eH6KWKlm+HMT5KRfpRsl8ffyVg6DpbUd InhQgwKgI6cDecGZpvh7oGnpRT4sKJ71KjP8oIrojEuj7HOE4sFRiqzcJvhJzHDj72JG dLtd+YE3AOtaxRtDYAT6er6W2t3wcSe+ZtlDPJsJnrZX4I2AaoWEan6nqsnpvlYnGyBN 4aaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ja6Fajx1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si11875761ejt.583.2020.12.22.11.18.46; Tue, 22 Dec 2020 11:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ja6Fajx1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726350AbgLVTSg (ORCPT + 99 others); Tue, 22 Dec 2020 14:18:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbgLVTSg (ORCPT ); Tue, 22 Dec 2020 14:18:36 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC7FC0613D6; Tue, 22 Dec 2020 11:17:55 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id b26so25016015lff.9; Tue, 22 Dec 2020 11:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uAS0dihWy6acCqxpttIdhhTtHB8s/0UZpEYGm2Afc0A=; b=Ja6Fajx15rlf/wUqhyfUGdtaYQa9NzWt1VxfeKaPGV9DHxto9LH4yd453M9YVRn9hR kMbMcKAkpViTQLSWE6kfgTI9BzKCWleBfhF4TmcR8FomhMo+L1pLmEMxbkFr4E1Svw1X iH6DJqofxOW5ofM0w9hmIf01D2Fp9mgjq3RzN5mL/qEtilJU/pFtiNljC50W1hqQ9h6Z L1euixnvk5wTR9lEvRSwJzkfEpU9tm8R+yftg3S65OZT5rgnL5Tfw2M2LGeki9D0BLqS wI4IXEjFsh3bdQ1a0XPmqyAso4vjl+nJSZ1RGI4YOqkQWlpnKFhv+ZGCJjn//trtFq6Z QEIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uAS0dihWy6acCqxpttIdhhTtHB8s/0UZpEYGm2Afc0A=; b=CW7XuJyM06nTCd7ZzHpmMbRBtXqJc3TpBYgIpbEp4CsFCA6wVLDaKwiWF4Bk+g889w Unx7pEP8tF+PO1NdrB9+8pvpn8IQINoZHdL7CvgrQIx+nz5lPAipEba5c1Hwfr5l61lf BsoZTl+sDc+/Qg8SsmXT2TMNdynpruhGSdJVEiNiVLytLjQzWkiGhw9KyfW4as1I6RDm ER/lO/zj2804yIsSeRWyKvAl+NtmLUIHWQkkWmyO2zRLP+DyfXZ5691azgbE1PJSHb/k ODnTzNICB4WncuUnAhWYZ6UnYPFaOorM9wqttImggwmuU+tBbwlauiU4WtdzDUcb3RXd NNqg== X-Gm-Message-State: AOAM5311irgFsrl4TkrIF0fiuAOt0oYr/P0811xKLOpanG/jepvlw3xW /Pg/NN2t02c7daqa0jnQXdVHw25uzpM= X-Received: by 2002:a19:d93:: with SMTP id 141mr9654897lfn.229.1608664674109; Tue, 22 Dec 2020 11:17:54 -0800 (PST) Received: from [192.168.2.145] (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.googlemail.com with ESMTPSA id y9sm3014739ljy.37.2020.12.22.11.17.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Dec 2020 11:17:53 -0800 (PST) Subject: Re: [PATCH v2 14/48] opp: Filter out OPPs based on availability of a required-OPP To: Viresh Kumar Cc: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Mauro Carvalho Chehab , Rob Herring , Peter Geis , Nicolas Chauvet , Krzysztof Kozlowski , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Michael Turquette , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, linux-clk@vger.kernel.org References: <20201217180638.22748-1-digetx@gmail.com> <20201217180638.22748-15-digetx@gmail.com> <20201222085940.y625zxee4tevbqm5@vireshk-i7> From: Dmitry Osipenko Message-ID: <9ed8bde3-f7b5-025c-c038-87f35ea39e5f@gmail.com> Date: Tue, 22 Dec 2020 22:17:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: <20201222085940.y625zxee4tevbqm5@vireshk-i7> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 22.12.2020 11:59, Viresh Kumar пишет: > On 17-12-20, 21:06, Dmitry Osipenko wrote: >> A required OPP may not be available, and thus, all OPPs which are using >> this required OPP should be unavailable too. >> >> Signed-off-by: Dmitry Osipenko >> --- >> drivers/opp/core.c | 11 ++++++++++- >> 1 file changed, 10 insertions(+), 1 deletion(-) > > Please send a separate patchset for fixes, as these can also go to 5.11 itself. Alright, although I don't think that this patch fixes any problems for existing OPP users. >> diff --git a/drivers/opp/core.c b/drivers/opp/core.c >> index d9feb7639598..3d02fe33630b 100644 >> --- a/drivers/opp/core.c >> +++ b/drivers/opp/core.c >> @@ -1588,7 +1588,7 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, >> struct opp_table *opp_table, bool rate_not_available) >> { >> struct list_head *head; >> - int ret; >> + int i, ret; >> >> mutex_lock(&opp_table->lock); >> head = &opp_table->opp_list; >> @@ -1615,6 +1615,15 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, >> __func__, new_opp->rate); >> } >> >> + for (i = 0; i < opp_table->required_opp_count && new_opp->available; i++) { >> + if (new_opp->required_opps[i]->available) >> + continue; >> + >> + new_opp->available = false; >> + dev_warn(dev, "%s: OPP not supported by required OPP %pOF (%lu)\n", >> + __func__, new_opp->required_opps[i]->np, new_opp->rate); > > Why not just break from here ? The new_opp could be already marked as unavailable by a previous voltage check, hence this loop should be skipped entirely in that case.