From 8ec2d988475e4f8534a8b327798727579bd5d600 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Fri, 10 Feb 2023 18:36:33 +0800 Subject: [PATCH] hud: Replace usage of mtx_t with simple_mtx_t in hud_diskstat.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_diskstat.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/hud/hud_diskstat.c b/src/gallium/auxiliary/hud/hud_diskstat.c index 55bb902..66a586a 100644 --- a/src/gallium/auxiliary/hud/hud_diskstat.c +++ b/src/gallium/auxiliary/hud/hud_diskstat.c @@ -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" @@ -83,7 +84,7 @@ struct diskstat_info */ static int gdiskstat_count = 0; static struct list_head gdiskstat_list; -static mtx_t gdiskstat_mutex = _MTX_INITIALIZER_NP; +static simple_mtx_t gdiskstat_mutex = SIMPLE_MTX_INITIALIZER; static struct diskstat_info * find_dsi_by_name(const char *n, int mode) @@ -249,9 +250,9 @@ hud_get_num_disks(bool displayhelp) char name[64]; /* Return the number of block devices and partitions. */ - mtx_lock(&gdiskstat_mutex); + simple_mtx_lock(&gdiskstat_mutex); if (gdiskstat_count) { - mtx_unlock(&gdiskstat_mutex); + simple_mtx_unlock(&gdiskstat_mutex); return gdiskstat_count; } @@ -261,7 +262,7 @@ hud_get_num_disks(bool displayhelp) list_inithead(&gdiskstat_list); DIR *dir = opendir("/sys/block/"); if (!dir) { - mtx_unlock(&gdiskstat_mutex); + simple_mtx_unlock(&gdiskstat_mutex); return 0; } @@ -288,7 +289,7 @@ hud_get_num_disks(bool displayhelp) struct dirent *dpart; DIR *pdir = opendir(basename); if (!pdir) { - mtx_unlock(&gdiskstat_mutex); + simple_mtx_unlock(&gdiskstat_mutex); closedir(dir); return 0; } @@ -323,7 +324,7 @@ hud_get_num_disks(bool displayhelp) puts(line); } } - mtx_unlock(&gdiskstat_mutex); + simple_mtx_unlock(&gdiskstat_mutex); return gdiskstat_count; } -- 2.7.4