public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: Re: [for-next][PATCH 19/21] v4l: Export enums used by tracepoints to user space
Date: Wed, 8 Apr 2015 11:43:02 -0300	[thread overview]
Message-ID: <20150408114302.1cb02a24@recife.lan> (raw)
In-Reply-To: <20150408134927.583123685@goodmis.org>

Em Wed, 08 Apr 2015 09:48:23 -0400
Steven Rostedt <rostedt@goodmis.org> escreveu:

> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> Enums used by tracepoints for __print_symbolic() are shown in the
> tracepoint format files with just their names and not their values.
> This makes it difficult for user space tools to know how to convert the
> binary data into their string representations.
> 
> By adding the use of TRACE_DEFINE_ENUM(), the enum names will be mapped
> to their values and shown in the tracing file system to let tools
> convert the data as necessary.
> 
> Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org
> 
> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>

Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  include/trace/events/v4l2.h | 75 ++++++++++++++++++++++++++++++---------------
>  1 file changed, 50 insertions(+), 25 deletions(-)
> 
> diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
> index b9bb1f204693..20112170ff11 100644
> --- a/include/trace/events/v4l2.h
> +++ b/include/trace/events/v4l2.h
> @@ -6,33 +6,58 @@
>  
>  #include <linux/tracepoint.h>
>  
> -#define show_type(type)							       \
> -	__print_symbolic(type,						       \
> -		{ V4L2_BUF_TYPE_VIDEO_CAPTURE,	      "VIDEO_CAPTURE" },       \
> -		{ V4L2_BUF_TYPE_VIDEO_OUTPUT,	      "VIDEO_OUTPUT" },	       \
> -		{ V4L2_BUF_TYPE_VIDEO_OVERLAY,	      "VIDEO_OVERLAY" },       \
> -		{ V4L2_BUF_TYPE_VBI_CAPTURE,	      "VBI_CAPTURE" },	       \
> -		{ V4L2_BUF_TYPE_VBI_OUTPUT,	      "VBI_OUTPUT" },	       \
> -		{ V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,   "SLICED_VBI_CAPTURE" },  \
> -		{ V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,    "SLICED_VBI_OUTPUT" },   \
> -		{ V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\
> -		{ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\
> -		{ V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,  "VIDEO_OUTPUT_MPLANE" }, \
> -		{ V4L2_BUF_TYPE_SDR_CAPTURE,          "SDR_CAPTURE" },         \
> -		{ V4L2_BUF_TYPE_PRIVATE,	      "PRIVATE" })
> +/* Enums require being exported to userspace, for user tool parsing */
> +#undef EM
> +#undef EMe
> +#define EM(a, b)	TRACE_DEFINE_ENUM(a);
> +#define EMe(a, b)	TRACE_DEFINE_ENUM(a);
> +
> +#define show_type(type)							\
> +	__print_symbolic(type, SHOW_TYPE)
> +
> +#define SHOW_TYPE							\
> +	EM( V4L2_BUF_TYPE_VIDEO_CAPTURE,	"VIDEO_CAPTURE" )	\
> +	EM( V4L2_BUF_TYPE_VIDEO_OUTPUT,		"VIDEO_OUTPUT" )	\
> +	EM( V4L2_BUF_TYPE_VIDEO_OVERLAY,	"VIDEO_OVERLAY" )	\
> +	EM( V4L2_BUF_TYPE_VBI_CAPTURE,		"VBI_CAPTURE" )		\
> +	EM( V4L2_BUF_TYPE_VBI_OUTPUT,		"VBI_OUTPUT" )		\
> +	EM( V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,   "SLICED_VBI_CAPTURE" )	\
> +	EM( V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,    "SLICED_VBI_OUTPUT" )	\
> +	EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" ) \
> +	EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \
> +	EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,  "VIDEO_OUTPUT_MPLANE" )	\
> +	EM( V4L2_BUF_TYPE_SDR_CAPTURE,          "SDR_CAPTURE" )		\
> +	EMe(V4L2_BUF_TYPE_PRIVATE,		"PRIVATE" )
> +
> +SHOW_TYPE
>  
>  #define show_field(field)						\
> -	__print_symbolic(field,						\
> -		{ V4L2_FIELD_ANY,		"ANY" },		\
> -		{ V4L2_FIELD_NONE,		"NONE" },		\
> -		{ V4L2_FIELD_TOP,		"TOP" },		\
> -		{ V4L2_FIELD_BOTTOM,		"BOTTOM" },		\
> -		{ V4L2_FIELD_INTERLACED,	"INTERLACED" },		\
> -		{ V4L2_FIELD_SEQ_TB,		"SEQ_TB" },		\
> -		{ V4L2_FIELD_SEQ_BT,		"SEQ_BT" },		\
> -		{ V4L2_FIELD_ALTERNATE,		"ALTERNATE" },		\
> -		{ V4L2_FIELD_INTERLACED_TB,	"INTERLACED_TB" },      \
> -		{ V4L2_FIELD_INTERLACED_BT,	"INTERLACED_BT" })
> +	__print_symbolic(field, SHOW_FIELD)
> +
> +#define SHOW_FIELD							\
> +	EM( V4L2_FIELD_ANY,		"ANY" )				\
> +	EM( V4L2_FIELD_NONE,		"NONE" )			\
> +	EM( V4L2_FIELD_TOP,		"TOP" )				\
> +	EM( V4L2_FIELD_BOTTOM,		"BOTTOM" )			\
> +	EM( V4L2_FIELD_INTERLACED,	"INTERLACED" )			\
> +	EM( V4L2_FIELD_SEQ_TB,		"SEQ_TB" )			\
> +	EM( V4L2_FIELD_SEQ_BT,		"SEQ_BT" )			\
> +	EM( V4L2_FIELD_ALTERNATE,	"ALTERNATE" )			\
> +	EM( V4L2_FIELD_INTERLACED_TB,	"INTERLACED_TB" )		\
> +	EMe( V4L2_FIELD_INTERLACED_BT,	"INTERLACED_BT" )
> +
> +SHOW_FIELD
> +
> +/*
> + * Now redefine the EM() and EMe() macros to map the enums to the strings
> + * that will be printed in the output.
> + */
> +#undef EM
> +#undef EMe
> +#define EM(a, b)	{a, b},
> +#define EMe(a, b)	{a, b}
> +
> +/* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */
>  
>  #define show_timecode_type(type)					\
>  	__print_symbolic(type,						\

  reply	other threads:[~2015-04-08 14:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 13:48 [for-next][PATCH 00/21] tracing: Addition of TRACE_DEFINE_ENUM() to convert enums it TP_printk() Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 01/21] tracing/drm: Remove unused TRACE_SYSTEM_STRING define Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 02/21] tracing: Add TRACE_SYSTEM_VAR to intel-sst Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 03/21] tracing: Add TRACE_SYSTEM_VAR to kvm-s390 Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 04/21] tracing: Add TRACE_SYSTEM_VAR to xhci-hcd Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 05/21] mac80211: Move message tracepoints to their own header Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 06/21] iwlwifi: Move each system " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 07/21] brcmsmac: " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 08/21] tracing: Give system name a pointer Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 09/21] tracing: Update trace-event-sample with TRACE_SYSTEM_VAR documentation Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 10/21] tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 11/21] tracing: Allow for modules to convert their enums to values Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 12/21] tracing/samples: Update the trace-event-sample.h with TRACE_DEFINE_ENUM() Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 13/21] x86/tlb/trace: Export enums in used by tlb_flush tracepoint Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 14/21] net/9p/tracing: Export enums in tracepoints to userspace Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 15/21] f2fs: Export the enums in the " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 16/21] irq/tracing: Export enums in tracepoints to user space Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 17/21] mm: tracing: " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 18/21] SUNRPC: " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 19/21] v4l: Export enums used by " Steven Rostedt
2015-04-08 14:43   ` Mauro Carvalho Chehab [this message]
2015-04-08 14:56     ` Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 20/21] writeback: Export enums used by tracepoint " Steven Rostedt
2015-04-08 13:48 ` [for-next][PATCH 21/21] tracing: Add enum_map file to show enums that have been mapped Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150408114302.1cb02a24@recife.lan \
    --to=mchehab@osg.samsung.com \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox