Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2312245pxp; Mon, 7 Mar 2022 12:38:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOBieiD09o+6iaqqo0Inrbd8MS1MD/GpL9YS6iUFYD2rQLIML8nKISMqCKBCL+SI72Eguv X-Received: by 2002:a17:907:6296:b0:6da:745b:7b40 with SMTP id nd22-20020a170907629600b006da745b7b40mr10450982ejc.750.1646685500644; Mon, 07 Mar 2022 12:38:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646685500; cv=none; d=google.com; s=arc-20160816; b=JeTj/PrtanrddxqAk6H52lUdo6suVaWIwkQkO0+MAyF/qoRaIRVaIMv5kRnmBsZpmB wjRVGgQXja+W4cxk4rrMLOZWKDSdyVjn6WNSZ1gB67SV5gLzaadYIIsMRvbAqsDkZ8+f SKcvWhIOr/nuXy1VRbQ3hyt8vLurcoJEBlxxZCoWjUvJ85Rn3eA7ZE38S08J+WB4thCS rzCnrsJ5f6AYckr8F07s2ooSwg+qDE9dFJ8stvaSg5jr0IuG9e8q4tPF4mrWr5ezRXqH neZjovtu6JXu8gjBmd9cwEszQhWI0vLwjMm4h+nsnrtETNgtOTRG2gt4v9Tvts3wBmFm O2yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=JgPFBkbztEBtMJP0LHD1YxBIa8nGPhe2QaYONr9BDe4=; b=GuRPRndTIhvZG4t0MHtLp8U3QQbRN+Y47xMoh3X/sMWSAa0mngpR8gjdMHoRT7IRj9 Z5ueEFHPPTNVkGqlswBjJcX4s0lR7GxhtudO+HNmyhmlECuOKp/FdjPljSiE3ZPm08ST bqLMHSDdJQDFFDsSeu/84xhYXFfQ7YQFREn0cMt4slBloEs8afExvfvgAqTuQoXQe+R8 fmcJnUXLGvxy8iMjjL13e2vr5iWBUqI7mqgIqK0CuGMQU8D+aZSSf0C14pLszowu+Gjo b5gZpX9DuXdo9XxDxspAcPR5pdUTqJewMlqUlhoBeDur63B6ix857iJ/9a72ovyCQlPY 5XVg== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a17090604d100b006cf62858661si9902392eja.540.2022.03.07.12.37.56; Mon, 07 Mar 2022 12:38:20 -0800 (PST) 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244594AbiCGSU2 (ORCPT + 99 others); Mon, 7 Mar 2022 13:20:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244593AbiCGSU0 (ORCPT ); Mon, 7 Mar 2022 13:20:26 -0500 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D626180918; Mon, 7 Mar 2022 10:19:30 -0800 (PST) Received: by mail-yb1-f170.google.com with SMTP id b35so32663559ybi.13; Mon, 07 Mar 2022 10:19:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JgPFBkbztEBtMJP0LHD1YxBIa8nGPhe2QaYONr9BDe4=; b=N1sByrSgmydVDzCrX6MVf1CUtJnVh2k5ns74hjT4mjKGuoMlPvgKTR/YIAfzwPtskI R9mhWM3y4O5EgIfAyPbQn7gVcrf27abHmq+YNhbhVrOtkIxBdp8EGaW6IkkKyZQVIeBh kFbX5UFnGAiWcCQ6/ERXDeoIBtQYqPUYkCalzn0pcfT9KvRs59xGLEg6V0MUxEtoAivE 4/Bj/p+StAVWgjlTMuaXyHKYV1vReO1W9phtXqW4wwi42f2tuG6R+RdEVastCB1sA19b 20EiuuzrLMfAP6UuPgzkVF0jwpZwgXKKOFjU1iaFSm6hqeFNO8Fx1TADV7rXea0ajiEH NGsw== X-Gm-Message-State: AOAM531G2gVFni9/fVvgU4ZuPspv5un3laYjogFsg99rMaKCxGoQLSg3 NSTzIA9BjV6+hffcsDf139LNbpIY0pQx355dHjh1+v/m X-Received: by 2002:a25:d7c2:0:b0:628:9d06:457b with SMTP id o185-20020a25d7c2000000b006289d06457bmr8997916ybg.137.1646677170081; Mon, 07 Mar 2022 10:19:30 -0800 (PST) MIME-Version: 1.0 References: <20220306021250.64315-1-zhanglianjie@uniontech.com> In-Reply-To: <20220306021250.64315-1-zhanglianjie@uniontech.com> From: "Rafael J. Wysocki" Date: Mon, 7 Mar 2022 19:19:19 +0100 Message-ID: Subject: Re: [PATCH 1/2] cpufreq: unify the show() and store() styles of attr To: zhanglianjie Cc: "Rafael J. Wysocki" , Viresh Kumar , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 On Sun, Mar 6, 2022 at 3:13 AM zhanglianjie wrote: > > Unify the show() and store() styles of attr, > change show_xxx(), store_xxx() to xxx_show(), xxx_store(). You need to say something about motivation too. > Signed-off-by: zhanglianjie > > diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c > index 08515f7e515f..b6bd0ff35323 100644 > --- a/drivers/cpufreq/cpufreq_conservative.c > +++ b/drivers/cpufreq/cpufreq_conservative.c > @@ -146,7 +146,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy) > > /************************** sysfs interface ************************/ > > -static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set, > +static ssize_t sampling_down_factor_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -161,7 +161,7 @@ static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set, > return count; > } > > -static ssize_t store_up_threshold(struct gov_attr_set *attr_set, > +static ssize_t up_threshold_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -177,7 +177,7 @@ static ssize_t store_up_threshold(struct gov_attr_set *attr_set, > return count; > } > > -static ssize_t store_down_threshold(struct gov_attr_set *attr_set, > +static ssize_t down_threshold_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -195,7 +195,7 @@ static ssize_t store_down_threshold(struct gov_attr_set *attr_set, > return count; > } > > -static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set, > +static ssize_t ignore_nice_load_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -220,7 +220,7 @@ static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set, > return count; > } > > -static ssize_t store_freq_step(struct gov_attr_set *attr_set, const char *buf, > +static ssize_t freq_step_store(struct gov_attr_set *attr_set, const char *buf, > size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c > index 63f7c219062b..0d42cf8b88d8 100644 > --- a/drivers/cpufreq/cpufreq_governor.c > +++ b/drivers/cpufreq/cpufreq_governor.c > @@ -27,7 +27,7 @@ static DEFINE_MUTEX(gov_dbs_data_mutex); > > /* Common sysfs tunables */ > /* > - * store_sampling_rate - update sampling rate effective immediately if needed. > + * sampling_rate_store - update sampling rate effective immediately if needed. > * > * If new rate is smaller than the old, simply updating > * dbs.sampling_rate might not be appropriate. For example, if the > @@ -41,7 +41,7 @@ static DEFINE_MUTEX(gov_dbs_data_mutex); > * This must be called with dbs_data->mutex held, otherwise traversing > * policy_dbs_list isn't safe. > */ > -ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf, > +ssize_t sampling_rate_store(struct gov_attr_set *attr_set, const char *buf, > size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -80,7 +80,7 @@ ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf, > > return count; > } > -EXPORT_SYMBOL_GPL(store_sampling_rate); > +EXPORT_SYMBOL_GPL(sampling_rate_store); > > /** > * gov_update_cpu_data - Update CPU load data. > diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h > index bab8e6140377..65ecf32ba4f8 100644 > --- a/drivers/cpufreq/cpufreq_governor.h > +++ b/drivers/cpufreq/cpufreq_governor.h > @@ -51,7 +51,7 @@ static inline struct dbs_data *to_dbs_data(struct gov_attr_set *attr_set) > } > > #define gov_show_one(_gov, file_name) \ > -static ssize_t show_##file_name \ > +static ssize_t file_name##_show \ > (struct gov_attr_set *attr_set, char *buf) \ > { \ > struct dbs_data *dbs_data = to_dbs_data(attr_set); \ > @@ -60,7 +60,7 @@ static ssize_t show_##file_name \ > } > > #define gov_show_one_common(file_name) \ > -static ssize_t show_##file_name \ > +static ssize_t file_name##_show \ > (struct gov_attr_set *attr_set, char *buf) \ > { \ > struct dbs_data *dbs_data = to_dbs_data(attr_set); \ > @@ -69,11 +69,11 @@ static ssize_t show_##file_name \ > > #define gov_attr_ro(_name) \ > static struct governor_attr _name = \ > -__ATTR(_name, 0444, show_##_name, NULL) > +__ATTR(_name, 0444, _name##_show, NULL) > > #define gov_attr_rw(_name) \ > static struct governor_attr _name = \ > -__ATTR(_name, 0644, show_##_name, store_##_name) > +__ATTR(_name, 0644, _name##_show, _name##_store) > > /* Common to all CPUs of a policy */ > struct policy_dbs_info { > @@ -176,7 +176,7 @@ void od_register_powersave_bias_handler(unsigned int (*f) > (struct cpufreq_policy *, unsigned int, unsigned int), > unsigned int powersave_bias); > void od_unregister_powersave_bias_handler(void); > -ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf, > +ssize_t sampling_rate_store(struct gov_attr_set *attr_set, const char *buf, > size_t count); > void gov_update_cpu_data(struct dbs_data *dbs_data); > #endif /* _CPUFREQ_GOVERNOR_H */ > diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c > index 6a41ea4729b8..e8fbf970ff07 100644 > --- a/drivers/cpufreq/cpufreq_ondemand.c > +++ b/drivers/cpufreq/cpufreq_ondemand.c > @@ -202,7 +202,7 @@ static unsigned int od_dbs_update(struct cpufreq_policy *policy) > /************************** sysfs interface ************************/ > static struct dbs_governor od_dbs_gov; > > -static ssize_t store_io_is_busy(struct gov_attr_set *attr_set, const char *buf, > +static ssize_t io_is_busy_store(struct gov_attr_set *attr_set, const char *buf, > size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -220,7 +220,7 @@ static ssize_t store_io_is_busy(struct gov_attr_set *attr_set, const char *buf, > return count; > } > > -static ssize_t store_up_threshold(struct gov_attr_set *attr_set, > +static ssize_t up_threshold_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -237,7 +237,7 @@ static ssize_t store_up_threshold(struct gov_attr_set *attr_set, > return count; > } > > -static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set, > +static ssize_t sampling_down_factor_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -265,7 +265,7 @@ static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set, > return count; > } > > -static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set, > +static ssize_t ignore_nice_load_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > @@ -290,7 +290,7 @@ static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set, > return count; > } > > -static ssize_t store_powersave_bias(struct gov_attr_set *attr_set, > +static ssize_t powersave_bias_store(struct gov_attr_set *attr_set, > const char *buf, size_t count) > { > struct dbs_data *dbs_data = to_dbs_data(attr_set); > -- > 2.20.1 > > >