summaryrefslogtreecommitdiff
path: root/cpufreq
diff options
context:
space:
mode:
authorMike Gabriel <[email protected]>2019-08-10 02:25:24 +0200
committerZenWalker <[email protected]>2019-08-29 15:13:20 +0200
commit34d9b916fe4133457b7c2e7a00cd23f4f5b85114 (patch)
tree7da61c02ce44b53d9b1696f913dc8938c947facf /cpufreq
parente60a233bfb0b619be7cc8119bcebd40d7028efd5 (diff)
downloadmate-applets-34d9b916fe4133457b7c2e7a00cd23f4f5b85114.tar.bz2
mate-applets-34d9b916fe4133457b7c2e7a00cd23f4f5b85114.tar.xz
Make cpufreq builds independent from kernel header version.
Ported from gnome-applets, see git diff e48b2d73~..5882df7f cpufreq/ configure.ac on the gnome-applets repository. Fixes mate-desktop/mate-applets#238.
Diffstat (limited to 'cpufreq')
-rw-r--r--cpufreq/src/cpufreq-monitor-libcpufreq.c15
-rw-r--r--cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c10
2 files changed, 16 insertions, 9 deletions
diff --git a/cpufreq/src/cpufreq-monitor-libcpufreq.c b/cpufreq/src/cpufreq-monitor-libcpufreq.c
index 9821f2da..dd2722ba 100644
--- a/cpufreq/src/cpufreq-monitor-libcpufreq.c
+++ b/cpufreq/src/cpufreq-monitor-libcpufreq.c
@@ -19,11 +19,14 @@
* Authors : Carlos Garc�a Campos <[email protected]>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <glib.h>
#include <glib/gi18n.h>
#include <stdlib.h>
-#include <linux/version.h>
#include <cpufreq.h>
#include "cpufreq-monitor-libcpufreq.h"
#include "cpufreq-utils.h"
@@ -36,12 +39,12 @@ static GList *cpufreq_monitor_libcpufreq_get_available_governors (CPUFreqMon
G_DEFINE_TYPE (CPUFreqMonitorLibcpufreq, cpufreq_monitor_libcpufreq, CPUFREQ_TYPE_MONITOR)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
-typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
-#else
+#ifdef HAVE_GET_FREQUENCIES
typedef struct cpufreq_frequencies CPUFreqFrequencyList;
#define cpufreq_get_available_frequencies(cpu) cpufreq_get_frequencies ("available", cpu)
#define cpufreq_put_available_frequencies(first) cpufreq_put_frequencies (first)
+#else
+typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
#endif
typedef struct cpufreq_policy CPUFreqPolicy;
@@ -105,7 +108,7 @@ cpufreq_monitor_libcpufreq_new (guint cpu)
return CPUFREQ_MONITOR (monitor);
}
-#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 7, 0)
+#ifdef HAVE_IS_CPU_ONLINE
extern int cpupower_is_cpu_online (unsigned int cpu);
#endif
@@ -122,7 +125,7 @@ cpufreq_monitor_libcpufreq_run (CPUFreqMonitor *monitor)
/* Check whether it failed because
* cpu is not online.
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
+#ifndef HAVE_IS_CPU_ONLINE
if (!cpufreq_cpu_exists (cpu)) {
#else
if (cpupower_is_cpu_online (cpu)) {
diff --git a/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c b/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
index f3d76e7e..d2fda2bf 100644
--- a/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
+++ b/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
@@ -19,6 +19,10 @@
* Authors : Carlos Garc�a Campos <[email protected]>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <glib.h>
#include <glib/gstdio.h>
#include <cpufreq.h>
@@ -39,12 +43,12 @@ static gboolean cpufreq_selector_libcpufreq_set_governor (CPUFreqSelector
G_DEFINE_TYPE (CPUFreqSelectorLibcpufreq, cpufreq_selector_libcpufreq, CPUFREQ_TYPE_SELECTOR)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
-typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
-#else
+#ifdef HAVE_GET_FREQUENCIES
typedef struct cpufreq_frequencies CPUFreqFrequencyList;
#define cpufreq_get_available_frequencies(cpu) cpufreq_get_frequencies ("available", cpu)
#define cpufreq_put_available_frequencies(first) cpufreq_put_frequencies (first)
+#else
+typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
#endif
typedef struct cpufreq_policy CPUFreqPolicy;