Commit Graph

6 Commits

Author SHA1 Message Date
Steven Rostedt (Google) 14a6043379 USB: gadget: udc: tracing: Do not open code __string() with __dynamic_array()
The event classes udc_log_ep and udc_log_req both declare:

    __dynamic_array(char, name, UDC_TRACE_STR_MAX)

Which will reserve UDC_TRACE_STR_MAX bytes on the ring buffer for the
event to write in name. It then uses snprintf() to write into that space.

Assuming that the string being copied is nul terminated, it is better to
just use the __string() helper. That way only the size of the string is
saved into the ring buffer and not the max size (yes, the entire
UDC_TRACE_STR_MAX is used in the trace event, and anything not used is
just junk in the ring buffer). Worse, there's also meta data saved into
the event that denotes where the string is stored in the event and also
saves its size, which is always going to be UDC_TRACE_STR_MAX.

Convert both to use the __string() and __assign_str() helpers that are for
this kind of use case.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20220703091449.317f94b1@rorschach.local.home
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-08 14:48:50 +02:00
Aditya Srivastava 1eef795312 USB: gadget: udc: fix kernel-doc syntax in file headers
The opening comment mark '/**' is used for highlighting the beginning of
kernel-doc comments.
The header for drivers/usb/gadget/udc/trace files follows this syntax, but
the content inside does not comply with kernel-doc.

This line was probably not meant for kernel-doc parsing, but is parsed
due to the presence of kernel-doc like comment syntax(i.e, '/**'), which
causes unexpected warning from kernel-doc.
For e.g., running scripts/kernel-doc -none drivers/usb/gadget/udc/trace.h
emits:
warning: expecting prototype for udc.c(). Prototype was for TRACE_SYSTEM() instead

Provide a simple fix by replacing this occurrence with general comment
format, i.e. '/*', to prevent kernel-doc from parsing it.

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Link: https://lore.kernel.org/r/20210522115227.9977-1-yashsri421@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-24 15:27:03 +02:00
Matthieu CASTET ac3865557b gadget event trace : add request pointer
This allows to identify transfer request, if more than one are in queue.

This is allowed by usb_ep_queue : "Any endpoint
(except control endpoints like ep0) may have more than one transfer
request queued; they complete in FIFO order."

For example with adb gadget with function fs :

     <-transport-225   [002] d..1    47.136641: usb_ep_queue: ep1out: req ffffffc07b93ef10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0
     ->transport-224   [000] d..1    47.153947: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0
              sh-452   [000] d.h2    47.153984: usb_gadget_giveback_request: ep1in: req ffffffc07c0def10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0
              sh-452   [000] d.h.    47.154305: usb_gadget_giveback_request: ep1out: req ffffffc07b93ef10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0
     <-transport-225   [002] d..1    47.154363: usb_ep_queue: ep1out: req ffffffc07b93ef10 length 0/21 sgs 0/0 stream 0 zsI status -115 --> 0
              sh-452   [000] d.h.    47.154378: usb_gadget_giveback_request: ep1out: req ffffffc07b93ef10 length 21/21 sgs 0/0 stream 0 zsI status 0 --> 0
     <-transport-225   [002] d..1    47.154463: usb_ep_queue: ep1out: req ffffffc07b93ef10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0
     ->transport-224   [000] d..1    47.154583: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0
              sh-452   [000] d.h2    47.154600: usb_gadget_giveback_request: ep1in: req ffffffc07c0def10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0
     ->transport-224   [000] d..1    47.164863: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/24 sgs 0/0 stream 0 zsI status -115 --> 0
     ->transport-224   [000] d.h1    47.164887: usb_gadget_giveback_request: ep1in: req ffffffc07c0def10 length 24/24 sgs 0/0 stream 0 zsI status 0 --> 0
     ->transport-224   [000] d..1    47.164907: usb_ep_queue: ep1in: req ffffffc07c0def10 length 0/122 sgs 0/0 stream 0 zsI status -115 --> 0

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-12-11 12:36:49 +02:00
Greg Kroah-Hartman 229e368239 USB: gadget: udc: Remove redundant license text
Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner.  So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text.  And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com>
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: Raviteja Garimella <raviteja.garimella@broadcom.com>
Cc: Romain Perier <romain.perier@collabora.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Al Cooper <alcooperx@gmail.com>
Cc: Srinath Mannam <srinath.mannam@broadcom.com>
Cc: Roger Quadros <rogerq@ti.com>
Cc: Krzysztof Opasiak <k.opasiak@samsung.com>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: "Felix Hädicke" <felixhaedicke@web.de>
Cc: Peter Chen <peter.chen@nxp.com>
Cc: Allen Pais <allen.lkml@gmail.com>
Cc: Yuyang Du <yuyang.du@intel.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-07 15:45:02 +01:00
Greg Kroah-Hartman 5fd54ace47 USB: add SPDX identifiers to all remaining files in drivers/usb/
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04 11:48:02 +01:00
Felipe Balbi 5e42d710a1 usb: gadget: add tracepoints to the gadget API
This new set of tracepoints will help all gadget
drivers and UDC drivers when problem appears. Note
that, in order to be able to add tracepoints to
udc-core.c we had to rename that to core.c and
statically link it with trace.c to form
udc-core.o. This is to make sure that module name
stays the same.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-06-21 10:38:41 +03:00