From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E955A0C41; Wed, 23 Jun 2021 14:27:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 950B64003F; Wed, 23 Jun 2021 14:27:54 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 6E51B4003E for ; Wed, 23 Jun 2021 14:27:52 +0200 (CEST) IronPort-SDR: 2gWkffyDKRuFq5Sas6Ydy19FB3QzJK59/19Rgdg4xxwIreNKApr41cnAjDBHatcLaSeVt5wpD5 rtxgEiXdJNCw== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="207187175" X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="207187175" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 05:27:26 -0700 IronPort-SDR: hCxZImvGXwweNjv7HQD/8f9ZacE4MGrEn/w2H5BWnSeRDMS7cObSxkJJd6uZ7djKUAU/2JpNem vZcvka/Hq0Sg== X-IronPort-AV: E=Sophos;i="5.83,293,1616482800"; d="scan'208";a="556129649" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.203.112]) ([10.213.203.112]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 05:27:25 -0700 To: David Hunt , dev@dpdk.org Cc: Richael.Zhuang@arm.com, stephen@networkplumber.org, reshma.pattan@intel.com, nd@arm.com References: <20210622125853.2798-1-david.hunt@intel.com> <20210623120342.36321-1-david.hunt@intel.com> <20210623120342.36321-2-david.hunt@intel.com> From: "Burakov, Anatoly" Message-ID: Date: Wed, 23 Jun 2021 13:27:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210623120342.36321-2-david.hunt@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 2/2] power: refactor pstate and acpi code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 23-Jun-21 1:03 PM, David Hunt wrote: > From: Anatoly Burakov > > Currently, ACPI and PSTATE modes have lots of code duplication, > confusing logic, and a bunch of other issues that can, and have, led to > various bugs and resource leaks. > > This commit factors out the common parts of sysfs reading/writing for > ACPI and PSTATE drivers. > > Signed-off-by: Anatoly Burakov > Signed-off-by: David Hunt > > --- > changes in v5 > * fixed bugs raised by Richael Zhuang in review - open file rw+, etc. > * removed FOPS* and FOPEN* macros, which contained control statements. > * fixed some checkpatch warnings. > changes in v6 > * fixed check of fputs return, negative on error. > --- > lib/power/meson.build | 7 + > lib/power/power_acpi_cpufreq.c | 192 ++++------------ > lib/power/power_common.c | 146 ++++++++++++ > lib/power/power_common.h | 17 ++ > lib/power/power_pstate_cpufreq.c | 374 ++++++++++--------------------- > 5 files changed, 335 insertions(+), 401 deletions(-) > > diff --git a/lib/power/meson.build b/lib/power/meson.build > index c1097d32f1..74c5f3a294 100644 > --- a/lib/power/meson.build > +++ b/lib/power/meson.build > @@ -5,6 +5,13 @@ if not is_linux > build = false > reason = 'only supported on Linux' > endif > + > +# we do some snprintf magic so silence format-nonliteral > +flag_nonliteral = '-Wno-format-nonliteral' > +if cc.has_argument(flag_nonliteral) > + cflags += flag_nonliteral > +endif > + I'll do a more thorough review later, but i suspect that we can drop this, if we fix the functions to have a GCC printf format attribute: https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html See "format" section. I'm not sure this is supported by other compilers though, so maybe it's better to keep it. -- Thanks, Anatoly