From patchwork Tue Sep 12 06:09:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 138292 Return-Path: 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 + 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 ); 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 To: , CC: , 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 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: 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 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 Acked-by: Viresh Kumar --- 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;