Skip to contentSkip to conversation

cpupower: avoid multiple definition with gcc -fno-common

PATCH Superseded Mike Gilbert 1 participant 1 message Feb 11, 2020 CPU power monitoring

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cpupower: avoid multiple definition with gcc -fno-common

The -fno-common option will be enabled by default in GCC 10.

---
 tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c  | 2 +-
 tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c    | 2 +-
 tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++
 tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +1 -1
index 33dc34db4f3c..20f46348271b 100644
@@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
 static struct pci_dev *amd_fam14h_pci_dev;
 static int nbp1_entered;
 
-struct timespec start_time;
+static struct timespec start_time;
 static unsigned long long timediff;
 
 #ifdef DEBUG
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +1 -1
index 3c4cee160b0e..a65f7d011513 100644
@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor;
 
 static unsigned long long **previous_count;
 static unsigned long long **current_count;
-struct timespec start_time;
+static struct timespec start_time;
 static unsigned long long timediff;
 
 static int cpuidle_get_count_percent(unsigned int id, double *percent,
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +2 -0
index 6d44fec55ad5..7c77045fef52 100644
@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = {
 0
 };
 
+int cpu_count;
+
 static struct cpuidle_monitor *monitors[MONITORS_MAX];
 static unsigned int avail_monitors;
 
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +1 -1
index 5b5eb1da0cce..c559d3115330 100644
@@ -25,7 +25,7 @@
 #endif
 #define CSTATE_DESC_LEN 60
 
-int cpu_count;
+extern int cpu_count;
 
 /* Hard to define the right names ...: */
 enum power_range_e {
Signature · 1 line
2.25.0