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 <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21284>
This commit is contained in:
@@ -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 <stdio.h>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user