]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: dwc3: debug: remove static char buffer from dwc3_decode_event()
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 28 Apr 2017 08:28:35 +0000 (11:28 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 2 Jun 2017 08:22:29 +0000 (11:22 +0300)
Instead, we can require caller to pass a buffer for the function to
use. This cleans things quite a bit.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/debug.h
drivers/usb/dwc3/trace.h

index cb2d8d3f7f3d8d052bb3a94a924ce37100683bb4..1025713ebdd1c6a5e57179cc99b91f621363cece 100644 (file)
@@ -173,9 +173,8 @@ static inline const char *dwc3_ep0_state_string(enum dwc3_ep0_state state)
  * @event: the event code
  */
 static inline const char *
-dwc3_gadget_event_string(const struct dwc3_event_devt *event)
+dwc3_gadget_event_string(char *str, const struct dwc3_event_devt *event)
 {
-       static char str[256];
        enum dwc3_link_state state = event->event_info & DWC3_LINK_STATE_MASK;
 
        switch (event->type) {
@@ -228,10 +227,10 @@ dwc3_gadget_event_string(const struct dwc3_event_devt *event)
  * @event: then event code
  */
 static inline const char *
-dwc3_ep_event_string(const struct dwc3_event_depevt *event, u32 ep0state)
+dwc3_ep_event_string(char *str, const struct dwc3_event_depevt *event,
+                    u32 ep0state)
 {
        u8 epnum = event->endpoint_number;
-       static char str[256];
        size_t len;
        int status;
        int ret;
@@ -332,14 +331,14 @@ static inline const char *dwc3_gadget_event_type_string(u8 event)
        }
 }
 
-static inline const char *dwc3_decode_event(u32 event, u32 ep0state)
+static inline const char *dwc3_decode_event(char *str, u32 event, u32 ep0state)
 {
        const union dwc3_event evt = (union dwc3_event) event;
 
        if (evt.type.is_devspec)
-               return dwc3_gadget_event_string(&evt.devt);
+               return dwc3_gadget_event_string(str, &evt.devt);
        else
-               return dwc3_ep_event_string(&evt.depevt, ep0state);
+               return dwc3_ep_event_string(str, &evt.depevt, ep0state);
 }
 
 static inline const char *dwc3_ep_cmd_status_string(int status)
index 15909b579e69efb2e9a9ffc657ed3966a1343953..af093b4e5dc5014a4308ac1de3dc22143f44db4c 100644 (file)
@@ -60,13 +60,15 @@ DECLARE_EVENT_CLASS(dwc3_log_event,
        TP_STRUCT__entry(
                __field(u32, event)
                __field(u32, ep0state)
+               __dynamic_array(char, str, DWC3_MSG_MAX)
        ),
        TP_fast_assign(
                __entry->event = event;
                __entry->ep0state = dwc->ep0state;
        ),
        TP_printk("event (%08x): %s", __entry->event,
-                       dwc3_decode_event(__entry->event, __entry->ep0state))
+                       dwc3_decode_event(__get_str(str), __entry->event,
+                                         __entry->ep0state))
 );
 
 DEFINE_EVENT(dwc3_log_event, dwc3_event,