242 lines
9.5 KiB
Diff
242 lines
9.5 KiB
Diff
|
From 5ba48f7215b94dc43a28d2b5264c6fa65989add9 Mon Sep 17 00:00:00 2001
|
||
|
From: Ali Erdinc Koroglu <aekoroglu@linux.intel.com>
|
||
|
Date: Tue, 17 Oct 2023 15:16:22 +0300
|
||
|
Subject: [PATCH 1/2] Werror fixes
|
||
|
|
||
|
---
|
||
|
src/lpmd_config.c | 28 ++++++++++++++--------------
|
||
|
src/lpmd_cpu.c | 2 +-
|
||
|
src/lpmd_main.c | 2 --
|
||
|
src/lpmd_proc.c | 5 -----
|
||
|
src/lpmd_util.c | 2 --
|
||
|
5 files changed, 15 insertions(+), 24 deletions(-)
|
||
|
|
||
|
diff --git a/src/lpmd_config.c b/src/lpmd_config.c
|
||
|
index e360b29..a3c5bcf 100644
|
||
|
--- a/src/lpmd_config.c
|
||
|
+++ b/src/lpmd_config.c
|
||
|
@@ -54,7 +54,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
if (tmp_value) {
|
||
|
lpmd_log_info ("node type: Element, name: %s, value: %s\n", cur_node->name,
|
||
|
tmp_value);
|
||
|
- if (!strncmp (cur_node->name, "Mode", strlen ("Mode"))) {
|
||
|
+ if (!strncmp((const char*)cur_node->name, "Mode", strlen("Mode"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->mode = strtol (tmp_value, &pos, 10);
|
||
|
lpmd_log_info ("mode %d, errno %d, tmp_value %p, pos %p\n", lpmd_config->mode,
|
||
|
@@ -64,21 +64,21 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
|| lpmd_config->mode < 0)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "HfiLpmEnable", strlen ("HfiEnable"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "HfiLpmEnable", strlen("HfiEnable"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->hfi_lpm_enable = strtol (tmp_value, &pos, 10);
|
||
|
if (errno || *pos != '\0'
|
||
|
|| (lpmd_config->hfi_lpm_enable != 1 && lpmd_config->hfi_lpm_enable != 0))
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "HfiSuvEnable", strlen ("HfiEnable"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "HfiSuvEnable", strlen("HfiEnable"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->hfi_suv_enable = strtol (tmp_value, &pos, 10);
|
||
|
if (errno || *pos != '\0'
|
||
|
|| (lpmd_config->hfi_suv_enable != 1 && lpmd_config->hfi_suv_enable != 0))
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "EntryDelayMS", strlen ("EntryDelayMS"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "EntryDelayMS", strlen ("EntryDelayMS"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->util_entry_delay = strtol (tmp_value, &pos, 10);
|
||
|
if (errno
|
||
|
@@ -86,7 +86,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
!= '\0'|| lpmd_config->util_entry_delay < 0 || lpmd_config->util_entry_delay > UTIL_DELAY_MAX)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "ExitDelayMS", strlen ("ExitDelayMS"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "ExitDelayMS", strlen ("ExitDelayMS"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->util_exit_delay = strtol (tmp_value, &pos, 10);
|
||
|
if (errno
|
||
|
@@ -94,7 +94,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
!= '\0'|| lpmd_config->util_exit_delay < 0 || lpmd_config->util_exit_delay > UTIL_DELAY_MAX)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "util_entry_threshold",
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "util_entry_threshold",
|
||
|
strlen ("util_entry_threshold"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->util_entry_threshold = strtol (tmp_value, &pos, 10);
|
||
|
@@ -102,7 +102,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
|| lpmd_config->util_entry_threshold > 100)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "util_exit_threshold",
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "util_exit_threshold",
|
||
|
strlen ("util_exit_threshold"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->util_exit_threshold = strtol (tmp_value, &pos, 10);
|
||
|
@@ -110,7 +110,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
|| lpmd_config->util_exit_threshold > 100)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "EntryHystMS", strlen ("EntryHystMS"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "EntryHystMS", strlen ("EntryHystMS"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->util_entry_hyst = strtol (tmp_value, &pos, 10);
|
||
|
if (errno
|
||
|
@@ -118,7 +118,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
!= '\0'|| lpmd_config->util_entry_hyst < 0 || lpmd_config->util_entry_hyst > UTIL_HYST_MAX)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "ExitHystMS", strlen ("ExitHystMS"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "ExitHystMS", strlen ("ExitHystMS"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->util_exit_hyst = strtol (tmp_value, &pos, 10);
|
||
|
if (errno
|
||
|
@@ -126,7 +126,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
!= '\0'|| lpmd_config->util_exit_hyst < 0 || lpmd_config->util_exit_hyst > UTIL_HYST_MAX)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "IgnoreITMT", strlen ("IgnoreITMT"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "IgnoreITMT", strlen ("IgnoreITMT"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->ignore_itmt = strtol (tmp_value, &pos, 10);
|
||
|
if (errno
|
||
|
@@ -134,14 +134,14 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
!= '\0'|| lpmd_config->ignore_itmt < 0 || lpmd_config->ignore_itmt > 1)
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "lp_mode_cpus", strlen ("lp_mode_cpus"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "lp_mode_cpus", strlen ("lp_mode_cpus"))) {
|
||
|
if (!strncmp (tmp_value, "-1", strlen ("-1")))
|
||
|
lpmd_config->lp_mode_cpus[0] = '\0';
|
||
|
else
|
||
|
snprintf (lpmd_config->lp_mode_cpus, sizeof(lpmd_config->lp_mode_cpus),
|
||
|
"%s", tmp_value);
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "PerformanceDef", strlen ("PerformanceDef"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "PerformanceDef", strlen ("PerformanceDef"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->performance_def = strtol (tmp_value, &pos, 10);
|
||
|
if (errno || *pos != '\0')
|
||
|
@@ -155,7 +155,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
else
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "BalancedDef", strlen ("BalancedDef"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "BalancedDef", strlen ("BalancedDef"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->balanced_def = strtol (tmp_value, &pos, 10);
|
||
|
if (errno || *pos != '\0')
|
||
|
@@ -169,7 +169,7 @@ static int lpmd_fill_config(xmlDoc *doc, xmlNode *a_node, lpmd_config_t *lpmd_co
|
||
|
else
|
||
|
goto err;
|
||
|
}
|
||
|
- else if (!strncmp (cur_node->name, "PowersaverDef", strlen ("PowersaverDef"))) {
|
||
|
+ else if (!strncmp((const char*)cur_node->name, "PowersaverDef", strlen ("PowersaverDef"))) {
|
||
|
errno = 0;
|
||
|
lpmd_config->powersaver_def = strtol (tmp_value, &pos, 10);
|
||
|
if (errno || *pos != '\0')
|
||
|
diff --git a/src/lpmd_cpu.c b/src/lpmd_cpu.c
|
||
|
index 04b47fc..703baea 100644
|
||
|
--- a/src/lpmd_cpu.c
|
||
|
+++ b/src/lpmd_cpu.c
|
||
|
@@ -161,7 +161,7 @@ static int cpumask_to_hexstr(cpu_set_t *mask, char *str, int size)
|
||
|
int cpu;
|
||
|
int i;
|
||
|
int pos = 0;
|
||
|
- char c;
|
||
|
+ char c = 0;
|
||
|
|
||
|
for (cpu = 0; cpu < topo_max_cpus; cpu++) {
|
||
|
i = cpu % 4;
|
||
|
diff --git a/src/lpmd_main.c b/src/lpmd_main.c
|
||
|
index 94bcc5b..fc671e9 100644
|
||
|
--- a/src/lpmd_main.c
|
||
|
+++ b/src/lpmd_main.c
|
||
|
@@ -157,9 +157,7 @@ int main(int argc, char *argv[])
|
||
|
gboolean log_info = FALSE;
|
||
|
gboolean log_debug = FALSE;
|
||
|
gboolean no_daemon = FALSE;
|
||
|
- gboolean ignore_itmt = FALSE;
|
||
|
gboolean systemd = FALSE;
|
||
|
- gchar *conf_file = NULL;
|
||
|
gboolean success;
|
||
|
GOptionContext *opt_ctx;
|
||
|
int ret;
|
||
|
diff --git a/src/lpmd_proc.c b/src/lpmd_proc.c
|
||
|
index 88ced8a..6361ee9 100644
|
||
|
--- a/src/lpmd_proc.c
|
||
|
+++ b/src/lpmd_proc.c
|
||
|
@@ -151,8 +151,6 @@ enum lpm_state {
|
||
|
/* Force off by default */
|
||
|
int lpm_state = LPM_USER_OFF;
|
||
|
|
||
|
-static pthread_mutex_t lpm_mutex;
|
||
|
-
|
||
|
/*
|
||
|
* 1: request valid and already satisfied. 0: respond valid and need to continue to process. -1: request invalid
|
||
|
*/
|
||
|
@@ -488,8 +486,6 @@ static void connect_to_power_profile_daemon(void)
|
||
|
/* Poll time out default */
|
||
|
#define POLL_TIMEOUT_DEFAULT_SECONDS 1
|
||
|
|
||
|
-static int poll_timeout_sec = POLL_TIMEOUT_DEFAULT_SECONDS;
|
||
|
-
|
||
|
static bool main_loop_terminate;
|
||
|
|
||
|
// called from LPMD main thread to process user and system messages
|
||
|
@@ -540,7 +536,6 @@ static int proc_message(message_capsul_t *msg)
|
||
|
static void* lpmd_core_main_loop(void *arg)
|
||
|
{
|
||
|
int interval, n;
|
||
|
- unsigned int i;
|
||
|
static int first_try = 1;
|
||
|
|
||
|
for (;;) {
|
||
|
diff --git a/src/lpmd_util.c b/src/lpmd_util.c
|
||
|
index d8e1543..8210cb7 100644
|
||
|
--- a/src/lpmd_util.c
|
||
|
+++ b/src/lpmd_util.c
|
||
|
@@ -198,8 +198,6 @@ enum system_status {
|
||
|
|
||
|
static enum system_status sys_stat = SYS_NORMAL;
|
||
|
|
||
|
-static struct timespec tp1, tp2;
|
||
|
-
|
||
|
static int first_run = 1;
|
||
|
|
||
|
static enum system_status get_sys_stat(void)
|
||
|
|
||
|
From 1668ed0265ed7cd0e21fe33dd82404b8087bb844 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Ali=20Erdin=C3=A7=20K=C3=B6ro=C4=9Flu?=
|
||
|
<aekoroglu@gmail.com>
|
||
|
Date: Fri, 27 Oct 2023 14:25:05 +0300
|
||
|
Subject: [PATCH 2/2] Update Makefile
|
||
|
|
||
|
use conditional variable
|
||
|
---
|
||
|
tools/Makefile | 4 ++--
|
||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/tools/Makefile b/tools/Makefile
|
||
|
index 9b5924c..670a74e 100755
|
||
|
--- a/tools/Makefile
|
||
|
+++ b/tools/Makefile
|
||
|
@@ -2,12 +2,12 @@ CFLAGS_DBUS_GLIB = $(shell pkg-config --cflags --libs dbus-glib-1)
|
||
|
|
||
|
bindir ?= /usr/bin
|
||
|
|
||
|
-CFLAGS = -g -Wall -Werror
|
||
|
+CFLAGS ?= -g -Wall -Werror
|
||
|
|
||
|
all: intel_lpmd_control
|
||
|
|
||
|
intel_lpmd_control: intel_lpmd_control.c
|
||
|
- gcc $< -o $@ $(CFLAGS) $(CFLAGS_DBUS_GLIB)
|
||
|
+ gcc $< -o $@ $(CFLAGS) $(CFLAGS_DBUS_GLIB) $(LDFLAGS)
|
||
|
|
||
|
clean:
|
||
|
rm -f intel_lpmd_control
|