[Intel-gfx] [PATCH v2] drm/printer: Add drm_vprintf()

Daniel Vetter daniel at ffwll.ch
Fri Nov 10 11:28:46 UTC 2017


On Fri, Nov 10, 2017 at 09:52:26AM +0000, Chris Wilson wrote:
> Simple va_args equivalent to the existing drm_printf() for use with the
> drm_printer.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

I guess you want an ack from Dave for merging through drm-intel, pls ping
him for that since I'm vacationing next week. Or offload to the drm-intel
maintainers :-)

Cheers, Daniel
> ---
>  drivers/gpu/drm/drm_print.c |  5 +----
>  include/drm/drm_print.h     | 14 ++++++++++++++
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> 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 edcea83a5050..d8789b123cda 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -80,6 +80,20 @@ 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
> + * @f: format string
> + * @args: 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_seq_file_printer - construct a &drm_printer that outputs to &seq_file
> -- 
> 2.15.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list