[Xfce4-commits] [panel-plugins/xfce4-cpufreq-plugin] 01/02: Drop Intel p-state (Bug #13835)

noreply at xfce.org noreply at xfce.org
Fri May 4 05:12:46 CEST 2018


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-cpufreq-plugin.

commit 1fa2d8286dfa60abb01cb710fd3a91b31a54126c
Author: Timo Adler <adler at mecatronix.de>
Date:   Wed Jan 3 12:22:15 2018 +0100

    Drop Intel p-state (Bug #13835)
    
    Intel p-state doesn't put the current frequency into /proc/cpuinfo on newer linux
    kernels anymore. Instead it utilizes the /sysfs infrastructure as well.
---
 panel-plugin/xfce4-cpufreq-linux.c | 57 ++++++++++++--------------------------
 1 file changed, 18 insertions(+), 39 deletions(-)

diff --git a/panel-plugin/xfce4-cpufreq-linux.c b/panel-plugin/xfce4-cpufreq-linux.c
index e1a40bf..ed61707 100644
--- a/panel-plugin/xfce4-cpufreq-linux.c
+++ b/panel-plugin/xfce4-cpufreq-linux.c
@@ -132,14 +132,11 @@ cpufreq_cpu_parse_sysfs_init (gint cpu_number, CpuInfo *cpu)
 	g_free (file);
 
 	/* read current cpu freq */
-	if (cpuFreq->intel_pstate == NULL) {
-		file =
-			g_strdup_printf ("/sys/devices/system/cpu/cpu%i/"
-							 "cpufreq/scaling_cur_freq",
-							 cpu_number);
-		SYSFS_READ_INT (file, contents, cpu->cur_freq);
-		g_free (file);
-	}
+        file = g_strdup_printf ("/sys/devices/system/cpu/cpu%i/"
+                                "cpufreq/scaling_cur_freq",
+                                cpu_number);
+        SYSFS_READ_INT (file, contents, cpu->cur_freq);
+        g_free (file);
 
 	/* read current cpu governor */
 	file = g_strdup_printf (
@@ -175,14 +172,11 @@ cpufreq_cpu_read_sysfs_current (gint cpu_number)
 	cpu = g_ptr_array_index (cpuFreq->cpus, cpu_number);
 
 	/* read current cpu freq */
-	if (cpuFreq->intel_pstate == NULL) {
-		file =
-			g_strdup_printf ("/sys/devices/system/cpu/cpu%i/"
-							 "cpufreq/scaling_cur_freq",
-							 cpu_number);
-		SYSFS_READ_INT (file, contents, cpu->cur_freq);
-		g_free (file);
-	}
+        file = g_strdup_printf ("/sys/devices/system/cpu/cpu%i/"
+                                "cpufreq/scaling_cur_freq",
+                                cpu_number);
+        SYSFS_READ_INT (file, contents, cpu->cur_freq);
+        g_free (file);
 
 	/* read current cpu governor */
 	file = g_strdup_printf ("/sys/devices/system/cpu/cpu%i/"
@@ -397,18 +391,12 @@ cpufreq_cpu_intel_pstate_read ()
 	/* gather intel pstate parameters */
 	if (!cpufreq_intel_pstate_params ())
 		return FALSE;
-
-	/* Read /proc/cpuinfo, that's where intel pstate stores
-	   the "current frequencies" that are readable by
-	   unprivileged users. */
-	if (!cpufreq_cpu_read_procfs_cpuinfo ())
-		return FALSE;
-
-	/* now read the remaining cpufreq info for each cpu from sysfs */
-	for (i = 0; i < cpuFreq->cpus->len; i++) {
-		cpu = g_ptr_array_index (cpuFreq->cpus, i);
-		cpufreq_cpu_parse_sysfs_init (i, cpu);
-	}
+        /* now read the number of cpus and the remaining cpufreq info
+           for each of them from sysfs */
+        if (!cpufreq_cpu_read_sysfs ())
+          {
+            return FALSE;
+          }
 	return TRUE;
 }
 
@@ -417,17 +405,8 @@ cpufreq_update_cpus (gpointer data)
 {
 	gint i;
 
-	if (g_file_test ("/sys/devices/system/cpu/intel_pstate", G_FILE_TEST_EXISTS))
-	{
-		/* read current cpu frequencies from /proc/cpuinfo */
-		cpufreq_cpu_read_procfs_cpuinfo ();
-
-		/* read current scaling governor from sysfs */
-		for (i = 0; i < cpuFreq->cpus->len; i++)
-			cpufreq_cpu_read_sysfs_current (i);
-	}
-	else if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq",
-						  G_FILE_TEST_EXISTS))
+	if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq",
+                         G_FILE_TEST_EXISTS))
 	{
 		for (i = 0; i < cpuFreq->cpus->len; i++)
 			cpufreq_cpu_read_sysfs_current (i);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list