Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3408733rwb; Fri, 30 Sep 2022 03:13:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HsV/n164MXOUbrLQ0MZKlD5yYOvRiHyxFJ5f51+86zulL6YBri4earqoXWTnvna6IwPLy X-Received: by 2002:a05:6402:450c:b0:443:6279:774f with SMTP id ez12-20020a056402450c00b004436279774fmr7388775edb.11.1664532796657; Fri, 30 Sep 2022 03:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664532796; cv=none; d=google.com; s=arc-20160816; b=Md3AaOf/7XF82jgbMpsFDzvvPuRsL+nuXERruEgnbska0LSTjNq1Pk4iI7WZJmbDqc sBwFnDK7zbsfyqbAw2WvTSzdoDqv6HH5ZGEleoYYYwU87vpruBUWYRb0kwON9SIoUZ5o x8SiKnKhpswLOA1BDM/KEjlzc/0sSfrg+vW4WLgfkJZe64lK9516VVLjOm40GeesK/av J06Z2KP1iB3XKWUuonVjonbrnGs4jasJIqk0XZBfeiHMDYf1hx2/DytLxXJ6AGqR9D3f v9TGDpf0Yz2zEjKsOtcCCV5wrsVKLksPLTFr8u+l57F6w6SMMVAKO7GYyJVNmnDJf1cN ly9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=AZ+gxT+2g2RWYkmNMmFhUanx93+dfklNoBUKhXrFaBE=; b=npobRxRGDfYGySeECjOK+ylqSTcshT2RH0DiaxQ2TFCQoXU7BWHacuks3pHmtp1fto rEVXSta3Dtwj8sHCdREukyQYRW8g1vrmoRpEJNaE9xloJy4SQJ1iKmv76ASM529Rst7n SJNZGxK6OS2puiVF6Q3nx9TXBHsRnkAio6OSjG0v6up65UUPNs9GA+vp0Hx9XY1UBOv8 ZktQcjpRIPSC3wd0kIC/WOx17av/Tr30DEEAh85xjuNNehEMu8h8i6x1/V8kEpB7lh1X iBT6MAIk80/6ikdZUyZph1Y9j39F2l+3zjx/qiL/9JusTK7xzht479il6LGy9pxVxEfd cUng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg13-20020a170907a40d00b0076f061ffab4si1646044ejc.51.2022.09.30.03.12.50; Fri, 30 Sep 2022 03:13:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbiI3Jsv (ORCPT + 99 others); Fri, 30 Sep 2022 05:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231180AbiI3Jsk (ORCPT ); Fri, 30 Sep 2022 05:48:40 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CEE6E814DE; Fri, 30 Sep 2022 02:48:39 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 003A615A1; Fri, 30 Sep 2022 02:48:46 -0700 (PDT) Received: from e123648.arm.com (unknown [10.57.0.185]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 172133F73B; Fri, 30 Sep 2022 02:48:37 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, lukasz.luba@arm.com, viresh.kumar@linaro.org, Dietmar.Eggemann@arm.com Subject: [PATCH 1/2] cpufreq: Change macro for store scaling min/max frequency Date: Fri, 30 Sep 2022 10:48:20 +0100 Message-Id: <20220930094821.31665-1-lukasz.luba@arm.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to prepare extension to the store_scaling_max_freq() remove the macro and use two normal functions. The set value for max frequency is important for the task scheduler. Signed-off-by: Lukasz Luba --- drivers/cpufreq/cpufreq.c | 47 ++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 69b3d61852ac..1f8b93f42c76 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -715,26 +715,33 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf) return ret; } -/* - * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access - */ -#define store_one(file_name, object) \ -static ssize_t store_##file_name \ -(struct cpufreq_policy *policy, const char *buf, size_t count) \ -{ \ - unsigned long val; \ - int ret; \ - \ - ret = sscanf(buf, "%lu", &val); \ - if (ret != 1) \ - return -EINVAL; \ - \ - ret = freq_qos_update_request(policy->object##_freq_req, val);\ - return ret >= 0 ? count : ret; \ -} - -store_one(scaling_min_freq, min); -store_one(scaling_max_freq, max); +static ssize_t store_scaling_max_freq +(struct cpufreq_policy *policy, const char *buf, size_t count) +{ + unsigned long val; + int ret; + + ret = sscanf(buf, "%lu", &val); + if (ret != 1) + return -EINVAL; + + ret = freq_qos_update_request(policy->max_freq_req, val); + return ret >= 0 ? count : ret; +} + +static ssize_t store_scaling_min_freq +(struct cpufreq_policy *policy, const char *buf, size_t count) +{ + unsigned long val; + int ret; + + ret = sscanf(buf, "%lu", &val); + if (ret != 1) + return -EINVAL; + + ret = freq_qos_update_request(policy->min_freq_req, val); + return ret >= 0 ? count : ret; +} /* * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware -- 2.17.1