diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 82ff327eb2df..781518fd88e3 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -55,13 +55,10 @@ EXPORT_SYMBOL(__drm_printfn_debug); */ void drm_printf(struct drm_printer *p, const char *f, ...) { - struct va_format vaf; va_list args; va_start(args, f); - vaf.fmt = f; - vaf.va = &args; - p->printfn(p, &vaf); + drm_vprintf(p, f, &args); va_end(args); } EXPORT_SYMBOL(drm_printf); diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 0968e411f562..5f9932e2246e 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -80,6 +80,21 @@ void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf); __printf(2, 3) void drm_printf(struct drm_printer *p, const char *f, ...); +/** + * drm_vprintf - print to a &drm_printer stream + * @p: the &drm_printer + * @fmt: format string + * @va: the va_list + */ +__printf(2, 0) +static inline void +drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va) +{ + struct va_format vaf = { .fmt = fmt, .va = va }; + + p->printfn(p, &vaf); +} + /** * drm_printf_indent - Print to a &drm_printer stream with indentation * @printer: DRM printer