lkml.org 
[lkml]   [2013]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] i2c: Add message transfer tracepoints for I2C and SMBUS
On Fri, 13 Dec 2013 17:04:14 +0000
David Howells <dhowells@redhat.com> wrote:

> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > > Would it be possible to print this as a string rather than a number?
> > > The protocol numbers are completely arbitrary, so the reader would have
> > > to open i2c.h each time to figure out what is what.
> >
> > That can be done in the TP_printk() with:
> >
> > ".. %s ..", ..,
> > __print_symbolic(__entry->protocol,
> > { I2C_SMBUS_QUICK , "QUICK" },
> > { I2C_SMBUS_BYTE , "BYTE" },
> > { I2C_SMBUS_BYTE_DATA , "BYTE_DATA" },
> > [...]
> > { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA"}), ...
>
> What happens if the number isn't in the table?

It simply prints the hex value. See trace_output.c:

const char *
ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
const struct trace_print_flags *symbol_array)
{
int i;
const char *ret = p->buffer + p->len;

for (i = 0; symbol_array[i].name; i++) {

if (val != symbol_array[i].mask)
continue;

trace_seq_puts(p, symbol_array[i].name);
break;
}

if (ret == (const char *)(p->buffer + p->len))
trace_seq_printf(p, "0x%lx", val);

trace_seq_putc(p, 0);

return ret;
}

-- Steve



\
 
 \ /
  Last update: 2013-12-13 20:41    [W:2.056 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site