Re: [dpdk-dev] [PATCH v6 2/2] power: refactor pstate and acpi code
From: Burakov, Anatoly <hidden>
Date: 2021-06-23 12:27:56
On 23-Jun-21 1:03 PM, David Hunt wrote:
quoted hunk ↗ jump to hunk
From: Anatoly Burakov <redacted> 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 <redacted> Signed-off-by: David Hunt <redacted> --- 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