Re: [PATCH 11/11] dynamic_debug: use a single printk() to emit msgs
From: Bart Van Assche
Date: Fri Jul 15 2011 - 06:06:16 EST
On Thu, Jul 14, 2011 at 6:09 PM, Jason Baron <jbaron@xxxxxxxxxx> wrote:
> +static int dynamic_emit_prefix(const struct _ddebug *descriptor, char *buf)
> {
> char tid[sizeof(int) + sizeof(int)/2 + 4];
> char lineno[sizeof(int) + sizeof(int)/2];
> @@ -442,31 +444,33 @@ static int dynamic_emit_prefix(const struct _ddebug *descriptor)
> else
> lineno[0] = 0;
>
> - return printk(KERN_DEBUG "%s%s%s%s%s%s",
> - tid,
> - (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME) ?
> - descriptor->modname : "",
> - (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME) ?
> - ":" : "",
> - (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) ?
> - descriptor->function : "",
> - (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) ?
> - ":" : "",
> - lineno);
> + return snprintf(buf, PREFIX_SIZE, KERN_DEBUG"%s%s%s%s%s%s",
> + tid,
> + (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME) ?
> + descriptor->modname : "",
> + (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME) ?
> + ":" : "",
> + (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) ?
> + descriptor->function : "",
> + (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) ?
> + ":" : "", lineno);
> }
Not that's it important, but this change makes is possible to
eliminate the tid[] and lineno[] arrays again. Has that been
considered ?
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/