hud: Replace usage of mtx_t with simple_mtx_t in hud_sensors_temp.c
authorYonggang Luo <luoyonggang@gmail.com>
Fri, 10 Feb 2023 10:40:47 +0000 (18:40 +0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 31 May 2023 15:44:51 +0000 (15:44 +0000)
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>

src/gallium/auxiliary/hud/hud_sensors_temp.c

index 96876d3..6dc37e9 100644 (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;
 }