Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2605750ybk; Mon, 18 May 2020 03:28:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5kqmW4bN8T4Uk+5aknueNtqeySOz7MDBrNFJMawgvnT6UkxsEj9RjNogRxnTNUFyOgc7O X-Received: by 2002:a05:6402:169a:: with SMTP id a26mr2127340edv.321.1589797699352; Mon, 18 May 2020 03:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589797699; cv=none; d=google.com; s=arc-20160816; b=eQznCmmkAvxQ0nILkfKnRWA0gs1GaA3k+Ge9wg7LVEjfKBFyUqM8GrSzhA3DHCpIld /X59CwS/PrVl9PIuUmVuDd9MVVQPIta6scpEotsU4uQ2Bet2pOgiiTGxLe0egz8eua3U zTQRDCx7/yBN+bli+EX9wwh6Uenw9yXLuK1f9oeR1t+jkVoJfxDzydTUdJ45dV2wm1kb KhyX48MBTS6L/KR9STOBz+BkignjBINeqQXwuiDNCgZwDBP1NRW10b79XC9fp4P99I+L rIp04mzJWM5/mlJ2Yhd1+E9EXcxhR6NsLj2/ivjI3aheiBhf508LJ3rcPEKwZYwATv2y 9AuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MN1cOtvKgI2CDdfH9WOPeSju4XcYLF26UcOgbNUXW2c=; b=PRqzIpEZ2crqc5i3sYtxtKgSwRDGxWCDASNKB86Ml4dSWL9S7jmADjC4Eu7sMm41xH t86W2y7BqbHJUxEGqE6+Ic4IGw+1okTQiFPanUC8Jg+k+B7iXXHh0bBGIHplAIVNIUPl 7Y6CvLDB0Lqfmb3gHsf7QqozOk5ZSD4h3V0rVn8UYp/+q24wVjWaJvCDJ2+iItLUpD9s 7gsqrXu3bwBYxUZt6nZ+s8Ee5wCUiHIjR6e1LVUH11hKMpTY2YV7cBHMwTvnSA8a2Znj ZyJL5afpFsZwHk+gkkIRKnIohzQbVwm0uN+zho9o4MaEAbyj7+uO4UZtkVmNAo8MZEEa F9vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0jXev1k; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si6100270ejn.21.2020.05.18.03.27.56; Mon, 18 May 2020 03:28:19 -0700 (PDT) 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=@linaro.org header.s=google header.b=s0jXev1k; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbgERKYU (ORCPT + 99 others); Mon, 18 May 2020 06:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbgERKYS (ORCPT ); Mon, 18 May 2020 06:24:18 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E26FC05BD0B for ; Mon, 18 May 2020 03:24:18 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id 5so1722882pjd.0 for ; Mon, 18 May 2020 03:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MN1cOtvKgI2CDdfH9WOPeSju4XcYLF26UcOgbNUXW2c=; b=s0jXev1kMMyFXAQc2MlxaXXGTQRsM9VMaTox1IL/2+po4rKJvNHbldSkIaPdSsIxZ8 5WYkRgFYoASKVv+8qLmV5PRxhu7s1gF+uxWnoL4+oTFtJngKgRLUiJ6MPQg5Ft2zWJZG oOJmSifhMuJsM7gVceeeDadpRmpJdPJoajHSTnUh1LJF+caoQiUfo/7/hfxo6DZjN/BB ROGmQnVN4zeKIDdMfcw3SRZiryVueHB/tbEp9bXUtFd/NRbo++Cv0gc2t/8W89LAWKEa uf3ZKXCHhq+3lDBgXoilWViO008YLPDvSA+lZJF/+6Rz/Oj80isfSAjzuOeXk6FrFZaI 9fpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=MN1cOtvKgI2CDdfH9WOPeSju4XcYLF26UcOgbNUXW2c=; b=aoluHeS/J/9rBonEB4MOQtWjrc0N4RqO3r0fsVFd3MQkbFbqX2MqMDAA4+71ZAaxhq 5gbgRq+zcfx3nU650NyD7lJHnEdbGb6oilAWpoSZesgUzevahjcfln11QtzKuQheoWwe HKUc9CzGQvuW7gSHi+43wa7v2yhckeWp+dnqo72Z3bgptQ0z3n4EH4KhhLqQ7SuPiFU9 imlqb2XhD0s7B63a/mjrgLEToH9ZCPUt7hn3U1otmMlcQyb0s3HbFdhSQ05bNWs/xltM GFP9lGtfGwSziYqaQRsq10FEVoSUKN+pMeU5nrhbNmX5v9lkyU7CfsMgpMA06zdWj7+s uhHA== X-Gm-Message-State: AOAM532WuQHKQHBDa0/H8lwo3jo+jZm6mUtC03uZeCjek8Xshc3djQTc j1fqOxJET1WWB5wPgb9lANM6nw== X-Received: by 2002:a17:90a:c201:: with SMTP id e1mr19484028pjt.162.1589797457739; Mon, 18 May 2020 03:24:17 -0700 (PDT) Received: from localhost ([122.167.130.103]) by smtp.gmail.com with ESMTPSA id y75sm8603768pfb.212.2020.05.18.03.24.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2020 03:24:17 -0700 (PDT) Date: Mon, 18 May 2020 15:54:15 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Serge Semin , Serge Semin , Thomas Bogendoerfer , Ulf Hansson , Matthias Kaehlcke , Alexey Malahov , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, stable@vger.kernel.org, Frederic Weisbecker , Ingo Molnar , Yue Hu , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 20/20] cpufreq: Return zero on success in boost sw setting Message-ID: <20200518102415.k4c5qglodij5ac6h@vireshk-i7> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200518101109.4uggngudy4gfmlvo@vireshk-i7> <10461949.HoJUxHt8jL@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10461949.HoJUxHt8jL@kreacher> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18-05-20, 12:22, Rafael J. Wysocki wrote: > On Monday, May 18, 2020 12:11:09 PM CEST Viresh Kumar wrote: > > On 18-05-20, 11:53, Rafael J. Wysocki wrote: > > > That said if you really only want it to return 0 on success, you may as well > > > add a ret = 0; statement (with a comment explaining why it is needed) after > > > the last break in the loop. > > > > That can be done as well, but will be a bit less efficient as the loop > > will execute once for each policy, and so the statement will run > > multiple times. Though it isn't going to add any significant latency > > in the code. > > Right. > > However, the logic in this entire function looks somewhat less than > straightforward to me, because it looks like it should return an > error on the first policy without a frequency table (having a frequency > table depends on the driver and that is the same for all policies, so it > is pointless to iterate any further in that case). > > Also, the error should not be -EINVAL, because that means "invalid > argument" which would be the state value. > > So I would do something like this: > > --- > drivers/cpufreq/cpufreq.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > Index: linux-pm/drivers/cpufreq/cpufreq.c > =================================================================== > --- linux-pm.orig/drivers/cpufreq/cpufreq.c > +++ linux-pm/drivers/cpufreq/cpufreq.c > @@ -2535,26 +2535,27 @@ EXPORT_SYMBOL_GPL(cpufreq_update_limits) > static int cpufreq_boost_set_sw(int state) > { > struct cpufreq_policy *policy; > - int ret = -EINVAL; > > for_each_active_policy(policy) { > + int ret; > + > if (!policy->freq_table) > - continue; > + return -ENXIO; > > ret = cpufreq_frequency_table_cpuinfo(policy, > policy->freq_table); > if (ret) { > pr_err("%s: Policy frequency update failed\n", > __func__); > - break; > + return ret; > } > > ret = freq_qos_update_request(policy->max_freq_req, policy->max); > if (ret < 0) > - break; > + return ret; > } > > - return ret; > + return 0; > } > > int cpufreq_boost_trigger_state(int state) Acked-by: Viresh Kumar -- viresh