hud: Replace usage of mtx_t with simple_mtx_t in hud_sensors_temp.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:
Yonggang Luo 2023-02-10 18:40:47 +08:00 committed by Marge Bot
parent 33f10b32b6
commit 0a87dca434

View file

@ -32,6 +32,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 "util/u_string.h"
@ -51,7 +52,7 @@
*/
static int gsensors_temp_count = 0;
static struct list_head gsensors_temp_list;
static mtx_t gsensor_temp_mutex = _MTX_INITIALIZER_NP;
static simple_mtx_t gsensor_temp_mutex = SIMPLE_MTX_INITIALIZER;
struct sensors_temp_info
{
@ -328,15 +329,15 @@ int
hud_get_num_sensors(bool displayhelp)
{
/* Return the number of sensors detected. */
mtx_lock(&gsensor_temp_mutex);
simple_mtx_lock(&gsensor_temp_mutex);
if (gsensors_temp_count) {
mtx_unlock(&gsensor_temp_mutex);
simple_mtx_unlock(&gsensor_temp_mutex);
return gsensors_temp_count;
}
int ret = sensors_init(NULL);
if (ret) {
mtx_unlock(&gsensor_temp_mutex);
simple_mtx_unlock(&gsensor_temp_mutex);
return 0;
}
@ -372,7 +373,7 @@ hud_get_num_sensors(bool displayhelp)
}
}
mtx_unlock(&gsensor_temp_mutex);
simple_mtx_unlock(&gsensor_temp_mutex);
return gsensors_temp_count;
}