summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2019-05-09 17:36:08 +0200
committerraveit65 <[email protected]>2019-05-16 14:42:01 +0200
commitf25d2419474fcadcf93891aedc73a94ea914b077 (patch)
tree0e5aed6a549a29bc10a8729004470e01b35fa5fe
parentb39271088c447091fa5e7a8fe961ef40f24cdc3f (diff)
downloadmate-applets-f25d2419474fcadcf93891aedc73a94ea914b077.tar.bz2
mate-applets-f25d2419474fcadcf93891aedc73a94ea914b077.tar.xz
cpufreq: support kernel 5.1.0
-rw-r--r--cpufreq/src/cpufreq-monitor-libcpufreq.c9
-rw-r--r--cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c10
2 files changed, 17 insertions, 2 deletions
diff --git a/cpufreq/src/cpufreq-monitor-libcpufreq.c b/cpufreq/src/cpufreq-monitor-libcpufreq.c
index ed99aa40..9821f2da 100644
--- a/cpufreq/src/cpufreq-monitor-libcpufreq.c
+++ b/cpufreq/src/cpufreq-monitor-libcpufreq.c
@@ -36,8 +36,15 @@ static GList *cpufreq_monitor_libcpufreq_get_available_governors (CPUFreqMon
G_DEFINE_TYPE (CPUFreqMonitorLibcpufreq, cpufreq_monitor_libcpufreq, CPUFREQ_TYPE_MONITOR)
-typedef struct cpufreq_policy CPUFreqPolicy;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
+#else
+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)
+#endif
+
+typedef struct cpufreq_policy CPUFreqPolicy;
typedef struct cpufreq_available_governors CPUFreqGovernorList;
static void
diff --git a/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c b/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
index 62a4a1aa..f3d76e7e 100644
--- a/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
+++ b/cpufreq/src/cpufreq-selector/cpufreq-selector-libcpufreq.c
@@ -23,6 +23,7 @@
#include <glib/gstdio.h>
#include <cpufreq.h>
#include <stdlib.h>
+#include <linux/version.h>
#include "cpufreq-selector-libcpufreq.h"
@@ -38,8 +39,15 @@ static gboolean cpufreq_selector_libcpufreq_set_governor (CPUFreqSelector
G_DEFINE_TYPE (CPUFreqSelectorLibcpufreq, cpufreq_selector_libcpufreq, CPUFREQ_TYPE_SELECTOR)
-typedef struct cpufreq_policy CPUFreqPolicy;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
typedef struct cpufreq_available_frequencies CPUFreqFrequencyList;
+#else
+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)
+#endif
+
+typedef struct cpufreq_policy CPUFreqPolicy;
typedef struct cpufreq_available_governors CPUFreqGovernorList;
static void