accel/ivpu: Move recovery work to system_unbound_wq
[drm/drm-misc.git] / tools / verification / rv / src / utils.c
blob5677b439dc2f26699e00861e828a7dc8402aff7a
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * util functions.
5 * Copyright (C) 2022 Red Hat Inc, Daniel Bristot de Oliveira <bristot@kernel.org>
6 */
8 #include <stdarg.h>
9 #include <stdio.h>
10 #include <utils.h>
12 int config_debug;
14 #define MAX_MSG_LENGTH 1024
16 /**
17 * err_msg - print an error message to the stderr
19 void err_msg(const char *fmt, ...)
21 char message[MAX_MSG_LENGTH];
22 va_list ap;
24 va_start(ap, fmt);
25 vsnprintf(message, sizeof(message), fmt, ap);
26 va_end(ap);
28 fprintf(stderr, "%s", message);
31 /**
32 * debug_msg - print a debug message to stderr if debug is set
34 void debug_msg(const char *fmt, ...)
36 char message[MAX_MSG_LENGTH];
37 va_list ap;
39 if (!config_debug)
40 return;
42 va_start(ap, fmt);
43 vsnprintf(message, sizeof(message), fmt, ap);
44 va_end(ap);
46 fprintf(stderr, "%s", message);