Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2609285ybk; Mon, 18 May 2020 03:33:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx+YbFcwOtaxrYlTnyXvjfWfJFoJKJHdLDw/1qE1pQQ0/3t8Oga9y0G7Kffxj0NrGHgQQq X-Received: by 2002:a05:6402:31b1:: with SMTP id dj17mr13369535edb.142.1589798034022; Mon, 18 May 2020 03:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589798034; cv=none; d=google.com; s=arc-20160816; b=VbtTnzn83wVDT2LNx081eoOJpmFNjmeyHtyRjw6l5Kqh5G5rlz47/xiWcYO66YjDrz iD8fFG+6uL/ls/FhXeVp2XjukeeApJZCXzIuTtU2GI7zuOXVTi/vAEpYH3xmUEw/Rcte 9ts64haTD4ekeZQ19Hl3x6r0fDu2qngyQlNacZBmpQifaFZ+3w4FUyod+R4BSyggdUso M68Dw5UWPw9Lx0Iv4Lbt+cmu4HtWpXfmUJgTvYsOJuggQhxBnEgqK7d7z+OY24MnsLiS RFvYSw5d3aE55EUFHbxt2RaqWJfbE2GfocjmXPoPeTx4pJUOG1ylCrL5ZxErgzr3t26z UT6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=U8D7sYUnugfd5XYaLfqmBTBIPpzi//D3YEefB1Wq+34=; b=xOKgXe4DOBXMnbAR2rGcnZxKzPxc1socX8r7y4zdR24WSw8QNSaAByrb3KtYgQMCxJ RpWdF7rIgA4QNuQnyJcxoOgsb19JdW/BcpwsS/Lq0EavvniOdFN4JPJ99LyvqOo6jLcv L90ZDqSdbjQEJxkG013VEj3iwkXWNOzJga2X9nzUhLwTLGKLgqz9h4clMUdqjP7IkRWG w760NBY59jNZB7jzGR2vccISwpc0gmz8+FLENWXQQkwkWYqvBvczFXt9gLrXngh10PZQ 9/qJ9BsQ5BmHKhazgXL6eM7ZglpxEexgYdzA1a+uy2jsar75WzXPzFrP1MeO1fHw2+eY /mBw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id si3si6101209ejb.5.2020.05.18.03.33.29; Mon, 18 May 2020 03:33:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgERKbM (ORCPT + 99 others); Mon, 18 May 2020 06:31:12 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:46076 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbgERKbM (ORCPT ); Mon, 18 May 2020 06:31:12 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id A9843803080B; Mon, 18 May 2020 10:31:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EV95sK1xaunt; Mon, 18 May 2020 13:31:08 +0300 (MSK) Date: Mon, 18 May 2020 13:31:02 +0300 From: Serge Semin To: Viresh Kumar CC: Serge Semin , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Thomas Bogendoerfer , Ulf Hansson , Matthias Kaehlcke , Alexey Malahov , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , , , , Frederic Weisbecker , Ingo Molnar , Yue Hu , , Subject: Re: [PATCH v2 20/20] cpufreq: Return zero on success in boost sw setting Message-ID: <20200518103102.t3a3g4uxeeuwsnix@mobilestation> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200518101109.4uggngudy4gfmlvo@vireshk-i7> <10461949.HoJUxHt8jL@kreacher> <20200518102415.k4c5qglodij5ac6h@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20200518102415.k4c5qglodij5ac6h@vireshk-i7> X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 18, 2020 at 03:54:15PM +0530, Viresh Kumar wrote: > 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 Ok. Thanks for the comments. Shall I resend the patch with update Rafael suggests or you'll merge the Rafael's fix in yourself? -Sergey > > -- > viresh