Skip to content

Commit 045706b

Browse files
rostedtgregkh
authored andcommitted
xhci: Do not open code __print_symbolic() in xhci trace events
libtraceevent (used by perf and trace-cmd) failed to parse the xhci_urb_dequeue trace event. This is because the user space trace event format parsing is not a full C compiler. It can handle some basic logic, but is not meant to be able to handle everything C can do. In cases where a trace event field needs to be converted from a number to a string, there's the __print_symbolic() macro that should be used: See samples/trace_events/trace-events-sample.h Some xhci trace events open coded the __print_symbolic() causing the user spaces tools to fail to parse it. This has to be replaced with __print_symbolic() instead. CC: [email protected] Reported-by: Tzvetomir Stoyanov <[email protected]> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206531 Fixes: 5abdc2e ("usb: host: xhci: add urb_enqueue/dequeue/giveback tracers") Signed-off-by: Steven Rostedt (VMware) <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c08ab39 commit 045706b

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

drivers/usb/host/xhci-trace.h

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,12 @@ DECLARE_EVENT_CLASS(xhci_log_urb,
289289
),
290290
TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
291291
__entry->epnum, __entry->dir_in ? "in" : "out",
292-
({ char *s;
293-
switch (__entry->type) {
294-
case USB_ENDPOINT_XFER_INT:
295-
s = "intr";
296-
break;
297-
case USB_ENDPOINT_XFER_CONTROL:
298-
s = "control";
299-
break;
300-
case USB_ENDPOINT_XFER_BULK:
301-
s = "bulk";
302-
break;
303-
case USB_ENDPOINT_XFER_ISOC:
304-
s = "isoc";
305-
break;
306-
default:
307-
s = "UNKNOWN";
308-
} s; }), __entry->urb, __entry->pipe, __entry->slot_id,
292+
__print_symbolic(__entry->type,
293+
{ USB_ENDPOINT_XFER_INT, "intr" },
294+
{ USB_ENDPOINT_XFER_CONTROL, "control" },
295+
{ USB_ENDPOINT_XFER_BULK, "bulk" },
296+
{ USB_ENDPOINT_XFER_ISOC, "isoc" }),
297+
__entry->urb, __entry->pipe, __entry->slot_id,
309298
__entry->actual, __entry->length, __entry->num_mapped_sgs,
310299
__entry->num_sgs, __entry->stream, __entry->flags
311300
)

0 commit comments

Comments
 (0)