Re: [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 9, 2010 at 7:35 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> Using %pV reduces the number of printk calls and
> eliminates any possible message interleaving from
> other printk calls.
>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
> Âdrivers/gpu/drm/drm_stub.c | Â 14 +++++++++++---
> Â1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index cdc89ee..e632527 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -57,13 +57,21 @@ void drm_ut_debug_printk(unsigned int request_level,
> Â Â Â Â Â Â Â Â Â Â Â Â const char *function_name,
> Â Â Â Â Â Â Â Â Â Â Â Â const char *format, ...)
> Â{
> + Â Â Â struct va_format vaf;
> Â Â Â Âva_list args;
>
> Â Â Â Âif (drm_debug & request_level) {
> - Â Â Â Â Â Â Â if (function_name)
> - Â Â Â Â Â Â Â Â Â Â Â printk(KERN_DEBUG "[%s:%s], ", prefix, function_name);
> Â Â Â Â Â Â Â Âva_start(args, format);
> - Â Â Â Â Â Â Â vprintk(format, args);
> +
> + Â Â Â Â Â Â Â vaf.fmt = format;
> + Â Â Â Â Â Â Â vaf.va = &args;
> +
> + Â Â Â Â Â Â Â if (function_name)
> + Â Â Â Â Â Â Â Â Â Â Â printk(KERN_DEBUG "[%s:%s], %pV",
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âprefix, function_name, &vaf);
> + Â Â Â Â Â Â Â else
> + Â Â Â Â Â Â Â Â Â Â Â printk(KERN_DEBUG "%pV", &vaf);

Wouldn't it be easier and more convenient to just make the %pV format
specifier just expect a format string and the va_arg list?  Like this

  printk(KERN_DEBUG "%pV", format, &args);

I mean, the %pV is kernel specific and we can just change how it works.

Kristian
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux