hud: Replace usage of mtx_t with simple_mtx_t in hud_nic.c
authorYonggang Luo <luoyonggang@gmail.com>
Fri, 10 Feb 2023 10:38:58 +0000 (18:38 +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_nic.c

index b54af2a..6926d84 100644 (file)
@@ -35,6 +35,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"
@@ -68,7 +69,7 @@ struct nic_info
  */
 static int gnic_count = 0;
 static struct list_head gnic_list;
-static mtx_t gnic_mutex = _MTX_INITIALIZER_NP;
+static simple_mtx_t gnic_mutex = SIMPLE_MTX_INITIALIZER;
 
 static struct nic_info *
 find_nic_by_name(const char *n, int mode)
@@ -334,9 +335,9 @@ hud_get_num_nics(bool displayhelp)
    char name[64];
 
    /* Return the number if network interfaces. */
-   mtx_lock(&gnic_mutex);
+   simple_mtx_lock(&gnic_mutex);
    if (gnic_count) {
-      mtx_unlock(&gnic_mutex);
+      simple_mtx_unlock(&gnic_mutex);
       return gnic_count;
    }
 
@@ -346,7 +347,7 @@ hud_get_num_nics(bool displayhelp)
    list_inithead(&gnic_list);
    DIR *dir = opendir("/sys/class/net/");
    if (!dir) {
-      mtx_unlock(&gnic_mutex);
+      simple_mtx_unlock(&gnic_mutex);
       return 0;
    }
 
@@ -422,7 +423,7 @@ hud_get_num_nics(bool displayhelp)
 
    }
 
-   mtx_unlock(&gnic_mutex);
+   simple_mtx_unlock(&gnic_mutex);
    return gnic_count;
 }