drm/amd/display: Add dm_logger_append_va API
authorMichel Dänzer <michel.daenzer@amd.com>
Tue, 28 Nov 2017 11:06:13 +0000 (12:06 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2017 17:48:27 +0000 (12:48 -0500)
Same as dm_logger_append, except it takes a va_list instead of a
variable number of arguments. dm_logger_append is now a minimal wrapper
around dm_logger_append_va.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/basics/logger.c
drivers/gpu/drm/amd/display/include/logger_interface.h

index 2ff5b467603dee7570473be5d98b2bddfa6c6077..180a9d69d3511c34443c00d268cb846134d12007 100644 (file)
@@ -311,6 +311,18 @@ void dm_logger_append(
        struct log_entry *entry,
        const char *msg,
        ...)
+{
+       va_list args;
+
+       va_start(args, msg);
+       dm_logger_append_va(entry, msg, args);
+       va_end(args);
+}
+
+void dm_logger_append_va(
+       struct log_entry *entry,
+       const char *msg,
+       va_list args)
 {
        struct dal_logger *logger;
 
@@ -325,11 +337,8 @@ void dm_logger_append(
                dal_logger_should_log(logger, entry->type)) {
 
                uint32_t size;
-               va_list args;
                char buffer[LOG_MAX_LINE_SIZE];
 
-               va_start(args, msg);
-
                size = dm_log_to_buffer(
                        buffer, LOG_MAX_LINE_SIZE, msg, args);
 
@@ -338,8 +347,6 @@ void dm_logger_append(
                } else {
                        append_entry(entry, "LOG_ERROR, line too long\n", 27);
                }
-
-               va_end(args);
        }
 }
 
index 8e1fe70097be52b6c1c031ad172fd34d9c2b8a31..28dee960d5095b58f0d3e9006ed3bcb11f6e2a1a 100644 (file)
@@ -57,6 +57,11 @@ void dm_logger_append(
                const char *msg,
                ...);
 
+void dm_logger_append_va(
+               struct log_entry *entry,
+               const char *msg,
+               va_list args);
+
 void dm_logger_open(
                struct dal_logger *logger,
                struct log_entry *entry,