From a4c3d5d19f7dfa015d2220e94f0f73b8aa3b7734 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Fri, 10 Feb 2023 16:33:56 +0800 Subject: [PATCH] hud: Replace usage of mtx_t with simple_mtx_t in hud_cpufreq.c This is a prepare for removing _MTX_INITIALIZER_NP. Signed-off-by: Yonggang Luo Acked-by: David Heidelberg Acked-by: Eric Engestrom Part-of: --- src/gallium/auxiliary/hud/hud_cpufreq.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/hud/hud_cpufreq.c b/src/gallium/auxiliary/hud/hud_cpufreq.c index bf1be1e..f644225 100644 --- a/src/gallium/auxiliary/hud/hud_cpufreq.c +++ b/src/gallium/auxiliary/hud/hud_cpufreq.c @@ -36,6 +36,7 @@ #include "hud/hud_private.h" #include "util/list.h" #include "util/os_time.h" +#include "util/simple_mtx.h" #include "util/u_thread.h" #include "util/u_memory.h" #include @@ -62,7 +63,7 @@ struct cpufreq_info static int gcpufreq_count = 0; static struct list_head gcpufreq_list; -static mtx_t gcpufreq_mutex = _MTX_INITIALIZER_NP; +static simple_mtx_t gcpufreq_mutex = SIMPLE_MTX_INITIALIZER; static struct cpufreq_info * find_cfi_by_index(int cpu_index, int mode) @@ -190,9 +191,9 @@ hud_get_num_cpufreq(bool displayhelp) int cpu_index; /* Return the number of CPU metrics we support. */ - mtx_lock(&gcpufreq_mutex); + simple_mtx_lock(&gcpufreq_mutex); if (gcpufreq_count) { - mtx_unlock(&gcpufreq_mutex); + simple_mtx_unlock(&gcpufreq_mutex); return gcpufreq_count; } @@ -202,7 +203,7 @@ hud_get_num_cpufreq(bool displayhelp) list_inithead(&gcpufreq_list); DIR *dir = opendir("/sys/devices/system/cpu"); if (!dir) { - mtx_unlock(&gcpufreq_mutex); + simple_mtx_unlock(&gcpufreq_mutex); return 0; } @@ -252,7 +253,7 @@ hud_get_num_cpufreq(bool displayhelp) } } - mtx_unlock(&gcpufreq_mutex); + simple_mtx_unlock(&gcpufreq_mutex); return gcpufreq_count; } -- 2.7.4