From patchwork Wed May 6 17:42:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 11531679 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E9AC1392 for ; Wed, 6 May 2020 17:54:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 706D9206D5 for ; Wed, 6 May 2020 17:54:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728834AbgEFRyg (ORCPT ); Wed, 6 May 2020 13:54:36 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:33130 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728803AbgEFRyg (ORCPT ); Wed, 6 May 2020 13:54:36 -0400 X-Greylist: delayed 602 seconds by postgrey-1.27 at vger.kernel.org; Wed, 06 May 2020 13:54:34 EDT Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id D1D928000CF8; Wed, 6 May 2020 17:44:30 +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 dpFA3fEHy6Gk; Wed, 6 May 2020 20:44:29 +0300 (MSK) From: To: Thomas Bogendoerfer , "Rafael J. Wysocki" , Viresh Kumar , Ulf Hansson , Matthias Kaehlcke CC: Serge Semin , Serge Semin , Alexey Malahov , Paul Burton , Ralf Baechle , Arnd Bergmann , Rob Herring , , , , "Rafael J. Wysocki" , Frederic Weisbecker , Ingo Molnar , Yue Hu , , Subject: [PATCH v2 20/20] cpufreq: Return zero on success in boost sw setting Date: Wed, 6 May 2020 20:42:38 +0300 Message-ID: <20200506174238.15385-21-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Serge Semin Recent commit e61a41256edf ("cpufreq: dev_pm_qos_update_request() can return 1 on success") fixed a problem when active policies traverse was falsely stopped due to invalidly treating the non-zero return value from freq_qos_update_request() method as an error. Yes, that function can return positive values if the requested update actually took place. The current problem is that the returned value is then passed to the return cell of the cpufreq_boost_set_sw() (set_boost callback) method. This value is then also analyzed for being non-zero, which is also treated as having an error. As a result during the boost activation we'll get an error returned while having the QOS frequency update successfully performed. Fix this by returning a negative value from the cpufreq_boost_set_sw() if actual error was encountered and zero otherwise treating any positive values as the successful operations completion. Fixes: 18c49926c4bf ("cpufreq: Add QoS requests for userspace constraints") Signed-off-by: Serge Semin Acked-by: Viresh Kumar Cc: Alexey Malahov Cc: Thomas Bogendoerfer Cc: Paul Burton Cc: Ralf Baechle Cc: Arnd Bergmann Cc: Rob Herring Cc: linux-mips@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: stable@vger.kernel.org Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 045f9fe157ce..5870cdca88cf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2554,7 +2554,7 @@ static int cpufreq_boost_set_sw(int state) break; } - return ret; + return ret < 0 ? ret : 0; } int cpufreq_boost_trigger_state(int state)