Message ID | 20230912060942.2516761-1-liaochang1@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp525338vqx; Tue, 12 Sep 2023 09:24:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKman1YoEQvua8mQNewCSNdLHxA85NMYZAx8SGN+6MP3UaEDOEQ/QPbGbcXc07F/RLB53s X-Received: by 2002:a17:902:a409:b0:1b8:76ce:9d91 with SMTP id p9-20020a170902a40900b001b876ce9d91mr274510plq.1.1694535840931; Tue, 12 Sep 2023 09:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694535840; cv=none; d=google.com; s=arc-20160816; b=j5vrhV8dFXf4sNmADfRZDWbpcF/S85eOHN7XGUAAw5wQwhbtZledfj/s2xUp8WVw2M 39viqP8zyoUhMPBLZnD1W1MxJGL+x5JSMwgZuAjLj8mLRsJjWacBJOb5ZzHGSXype+bj mKqfJB3oqz7a/5t+DeK6s8l2NuwDH8p1GEkV8gUqJ2t96nS/4ajSWH+bn4B6GVVJBKBn Ryd9cvb5u51jh3SeGXqMjIdUmOVMVr3xsDQcKDevMPPQrC6lWWbxVN/KlOMhq9hv1/Lw Y8SwP87E6QtUUHXLrIo5junpa/IVWMlixHMOle/Zw5nI4jP5bKrwIAxe2py0UjoMx3QF K9ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=l9b3tc/f4uNDk8aQeez9KwPw9HpQXqGyYvX3c8CP2R8=; fh=0vaYOzzn3Z5SQEjgoqvxffIotvjIeDSv5QGTvx6cK/U=; b=zv0bAHokshlHqqj51V+qBymcUwkFpE78g/WcMyI4uwKx2qGB2omgkEuAAR5w9SOdYK pN43+Ess+6CT6bNTzfoTIwp5z85nUGJjW5Gqkxf6u0wiX33l6oirRrRdCTzKDsw72egO kHAJPCxMn181GIeLLG9MTYvg4Zv1kuH7aaknVI27lPTzYxHPITjK4MDzc8B4UJG6jtG2 gK7jNL3r1nhjRgz27xYftd5M7eFVUPwJfbivI0OkxdxRRZwVoMZ/SONdpTTj9Hn0sNoD DnjJIpVrx0lxVhjAAwn39s3eqT+YDwsk8zlALRUORj4v0OQ7KQF7zqaZ5xDQDdZQ6zJy pKZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id h5-20020a170902680500b001c3e3b19908si177885plk.485.2023.09.12.09.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 09:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 58C68852681B; Mon, 11 Sep 2023 23:12:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbjILGMI (ORCPT <rfc822;ruipengqi7@gmail.com> + 39 others); Tue, 12 Sep 2023 02:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjILGMG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Sep 2023 02:12:06 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62869AF; Mon, 11 Sep 2023 23:12:02 -0700 (PDT) Received: from kwepemd200002.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RlCnX6qYjzMlBJ; Tue, 12 Sep 2023 14:08:32 +0800 (CST) Received: from huawei.com (10.67.174.28) by kwepemd200002.china.huawei.com (7.221.188.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.23; Tue, 12 Sep 2023 14:11:58 +0800 From: Liao Chang <liaochang1@huawei.com> To: <rafael@kernel.org>, <viresh.kumar@linaro.org> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH] cpufreq: conservative: Simplify the condition of storing 'down_threshold' Date: Tue, 12 Sep 2023 06:09:42 +0000 Message-ID: <20230912060942.2516761-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.28] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemd200002.china.huawei.com (7.221.188.186) X-CFilter-Loop: Reflected Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 11 Sep 2023 23:12:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776849614273235905 X-GMAIL-MSGID: 1776849614273235905 |
Series |
cpufreq: conservative: Simplify the condition of storing 'down_threshold'
|
|
Commit Message
Liao Chang
Sept. 12, 2023, 6:09 a.m. UTC
The governor currently checks if the input new down_threshold is less
than 100 before storing it. However, the up_threshold field of dbs_data
structure is also limited to be less than 100, so this check is
unnecessary and remove it.
Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
drivers/cpufreq/cpufreq_conservative.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On 12-09-23, 06:09, Liao Chang wrote: > The governor currently checks if the input new down_threshold is less > than 100 before storing it. However, the up_threshold field of dbs_data > structure is also limited to be less than 100, so this check is > unnecessary and remove it. > > Signed-off-by: Liao Chang <liaochang1@huawei.com> > --- > drivers/cpufreq/cpufreq_conservative.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c > index b6bd0ff35323..56500b25d77c 100644 > --- a/drivers/cpufreq/cpufreq_conservative.c > +++ b/drivers/cpufreq/cpufreq_conservative.c > @@ -187,8 +187,7 @@ static ssize_t down_threshold_store(struct gov_attr_set *attr_set, > ret = sscanf(buf, "%u", &input); > > /* cannot be lower than 1 otherwise freq will not fall */ > - if (ret != 1 || input < 1 || input > 100 || > - input >= dbs_data->up_threshold) > + if (ret != 1 || input < 1 || input >= dbs_data->up_threshold) > return -EINVAL; > > cs_tuners->down_threshold = input; Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
On Thu, Oct 5, 2023 at 12:59 PM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > On 12-09-23, 06:09, Liao Chang wrote: > > The governor currently checks if the input new down_threshold is less > > than 100 before storing it. However, the up_threshold field of dbs_data > > structure is also limited to be less than 100, so this check is > > unnecessary and remove it. > > > > Signed-off-by: Liao Chang <liaochang1@huawei.com> > > --- > > drivers/cpufreq/cpufreq_conservative.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c > > index b6bd0ff35323..56500b25d77c 100644 > > --- a/drivers/cpufreq/cpufreq_conservative.c > > +++ b/drivers/cpufreq/cpufreq_conservative.c > > @@ -187,8 +187,7 @@ static ssize_t down_threshold_store(struct gov_attr_set *attr_set, > > ret = sscanf(buf, "%u", &input); > > > > /* cannot be lower than 1 otherwise freq will not fall */ > > - if (ret != 1 || input < 1 || input > 100 || > > - input >= dbs_data->up_threshold) > > + if (ret != 1 || input < 1 || input >= dbs_data->up_threshold) > > return -EINVAL; > > > > cs_tuners->down_threshold = input; > > Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Applied as 6.7 material, thanks!
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index b6bd0ff35323..56500b25d77c 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -187,8 +187,7 @@ static ssize_t down_threshold_store(struct gov_attr_set *attr_set, ret = sscanf(buf, "%u", &input); /* cannot be lower than 1 otherwise freq will not fall */ - if (ret != 1 || input < 1 || input > 100 || - input >= dbs_data->up_threshold) + if (ret != 1 || input < 1 || input >= dbs_data->up_threshold) return -EINVAL; cs_tuners->down_threshold = input;