forked from pool/cpupower
Thomas Renninger
d13d815a4c
- Fix static compilation and sysfs_read_file mess A cpupower_fix_compilation_and_sysfs_read_file_mess.patch OBS-URL: https://build.opensuse.org/request/show/642280 OBS-URL: https://build.opensuse.org/package/show/hardware/cpupower?expand=0&rev=83
98 lines
3.3 KiB
Diff
98 lines
3.3 KiB
Diff
From khlebnikov@yandex-team.ru
|
|
Subject: [PATCH] tools/power/cpupower: fix compilation with STATIC=true
|
|
From: "Konstantin Khlebnikov" <khlebnikov@yandex-team.ru>
|
|
To: "Shuah Khan" <shuah@kernel.org>,<trenn@suse.de>,
|
|
<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>
|
|
Date: Tue, 16 Oct 2018 11:56:26 +0300
|
|
Message-ID: <153968018626.397151.17942194042449956995.stgit@buzz>
|
|
User-Agent: StGit/0.17.1-dirty
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Rename duplicate sysfs_read_file into cpupower_read_sysfs and fix linking.
|
|
|
|
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
|
|
---
|
|
bench/Makefile | 2 +-
|
|
lib/cpufreq.c | 2 +-
|
|
lib/cpuidle.c | 2 +-
|
|
lib/cpupower.c | 4 ++--
|
|
lib/cpupower_intern.h | 2 +-
|
|
5 files changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/bench/Makefile b/bench/Makefile
|
|
index d79ab161cc75..f68b4bc55273 100644
|
|
--- a/bench/Makefile
|
|
+++ b/bench/Makefile
|
|
@@ -9,7 +9,7 @@ endif
|
|
ifeq ($(strip $(STATIC)),true)
|
|
LIBS = -L../ -L$(OUTPUT) -lm
|
|
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o \
|
|
- $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/sysfs.o
|
|
+ $(OUTPUT)../lib/cpufreq.o $(OUTPUT)../lib/cpupower.o
|
|
else
|
|
LIBS = -L../ -L$(OUTPUT) -lm -lcpupower
|
|
OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
|
|
diff --git a/lib/cpufreq.c b/lib/cpufreq.c
|
|
index 1b993fe1ce23..0c0f3e3f0d80 100644
|
|
--- a/lib/cpufreq.c
|
|
+++ b/lib/cpufreq.c
|
|
@@ -28,7 +28,7 @@ static unsigned int sysfs_cpufreq_read_file(unsigned int cpu, const char *fname,
|
|
|
|
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/cpufreq/%s",
|
|
cpu, fname);
|
|
- return sysfs_read_file(path, buf, buflen);
|
|
+ return cpupower_read_sysfs(path, buf, buflen);
|
|
}
|
|
|
|
/* helper function to write a new value to a /sys file */
|
|
diff --git a/lib/cpuidle.c b/lib/cpuidle.c
|
|
index 9bd4c7655fdb..852d25462388 100644
|
|
--- a/lib/cpuidle.c
|
|
+++ b/lib/cpuidle.c
|
|
@@ -319,7 +319,7 @@ static unsigned int sysfs_cpuidle_read_file(const char *fname, char *buf,
|
|
|
|
snprintf(path, sizeof(path), PATH_TO_CPU "cpuidle/%s", fname);
|
|
|
|
- return sysfs_read_file(path, buf, buflen);
|
|
+ return cpupower_read_sysfs(path, buf, buflen);
|
|
}
|
|
|
|
|
|
diff --git a/lib/cpupower.c b/lib/cpupower.c
|
|
index 9c395ec924de..9711d628b0f4 100644
|
|
--- a/lib/cpupower.c
|
|
+++ b/lib/cpupower.c
|
|
@@ -15,7 +15,7 @@
|
|
#include "cpupower.h"
|
|
#include "cpupower_intern.h"
|
|
|
|
-unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen)
|
|
+unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen)
|
|
{
|
|
int fd;
|
|
ssize_t numread;
|
|
@@ -95,7 +95,7 @@ static int sysfs_topology_read_file(unsigned int cpu, const char *fname, int *re
|
|
|
|
snprintf(path, sizeof(path), PATH_TO_CPU "cpu%u/topology/%s",
|
|
cpu, fname);
|
|
- if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0)
|
|
+ if (cpupower_read_sysfs(path, linebuf, MAX_LINE_LEN) == 0)
|
|
return -1;
|
|
*result = strtol(linebuf, &endp, 0);
|
|
if (endp == linebuf || errno == ERANGE)
|
|
diff --git a/lib/cpupower_intern.h b/lib/cpupower_intern.h
|
|
index 92affdfbe417..4887c76d23f8 100644
|
|
--- a/lib/cpupower_intern.h
|
|
+++ b/lib/cpupower_intern.h
|
|
@@ -3,4 +3,4 @@
|
|
#define MAX_LINE_LEN 4096
|
|
#define SYSFS_PATH_MAX 255
|
|
|
|
-unsigned int sysfs_read_file(const char *path, char *buf, size_t buflen);
|
|
+unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen);
|
|
|
|
|
|
|