diff mbox series

[v2,3/4] usb: dwc3: change some trace event __dynamic_array() to __get_buf()

Message ID 1677465850-1396-4-git-send-email-quic_linyyuan@quicinc.com (mailing list archive)
State Accepted
Commit f09d24aa463c51672ff37462fed17eff824b8b18
Headers show
Series usb: replace some __dynamic_array() to __get_buf() | expand

Commit Message

Linyu Yuan Feb. 27, 2023, 2:44 a.m. UTC
some __dynamic_array() buffer will only used at trace event output time,
change to __get_buf() which will allocate tempary trace seq buffer for
output purpose.

Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: no change

 drivers/usb/dwc3/trace.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Thinh Nguyen March 2, 2023, 1:38 a.m. UTC | #1
On Mon, Feb 27, 2023, Linyu Yuan wrote:
> some __dynamic_array() buffer will only used at trace event output time,
> change to __get_buf() which will allocate tempary trace seq buffer for
> output purpose.
> 
> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
> ---
> v2: no change
> 
>  drivers/usb/dwc3/trace.h | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
> index 1975aec..d2997d1 100644
> --- a/drivers/usb/dwc3/trace.h
> +++ b/drivers/usb/dwc3/trace.h
> @@ -54,14 +54,13 @@ 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(__get_str(str), DWC3_MSG_MAX,
> +			dwc3_decode_event(__get_buf(DWC3_MSG_MAX), DWC3_MSG_MAX,
>  					__entry->event, __entry->ep0state))
>  );
>  
> @@ -79,7 +78,6 @@ DECLARE_EVENT_CLASS(dwc3_log_ctrl,
>  		__field(__u16, wValue)
>  		__field(__u16, wIndex)
>  		__field(__u16, wLength)
> -		__dynamic_array(char, str, DWC3_MSG_MAX)
>  	),
>  	TP_fast_assign(
>  		__entry->bRequestType = ctrl->bRequestType;
> @@ -88,7 +86,7 @@ DECLARE_EVENT_CLASS(dwc3_log_ctrl,
>  		__entry->wIndex = le16_to_cpu(ctrl->wIndex);
>  		__entry->wLength = le16_to_cpu(ctrl->wLength);
>  	),
> -	TP_printk("%s", usb_decode_ctrl(__get_str(str), DWC3_MSG_MAX,
> +	TP_printk("%s", usb_decode_ctrl(__get_buf(DWC3_MSG_MAX), DWC3_MSG_MAX,
>  					__entry->bRequestType,
>  					__entry->bRequest, __entry->wValue,
>  					__entry->wIndex, __entry->wLength)
> -- 
> 2.7.4
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index 1975aec..d2997d1 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -54,14 +54,13 @@  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(__get_str(str), DWC3_MSG_MAX,
+			dwc3_decode_event(__get_buf(DWC3_MSG_MAX), DWC3_MSG_MAX,
 					__entry->event, __entry->ep0state))
 );
 
@@ -79,7 +78,6 @@  DECLARE_EVENT_CLASS(dwc3_log_ctrl,
 		__field(__u16, wValue)
 		__field(__u16, wIndex)
 		__field(__u16, wLength)
-		__dynamic_array(char, str, DWC3_MSG_MAX)
 	),
 	TP_fast_assign(
 		__entry->bRequestType = ctrl->bRequestType;
@@ -88,7 +86,7 @@  DECLARE_EVENT_CLASS(dwc3_log_ctrl,
 		__entry->wIndex = le16_to_cpu(ctrl->wIndex);
 		__entry->wLength = le16_to_cpu(ctrl->wLength);
 	),
-	TP_printk("%s", usb_decode_ctrl(__get_str(str), DWC3_MSG_MAX,
+	TP_printk("%s", usb_decode_ctrl(__get_buf(DWC3_MSG_MAX), DWC3_MSG_MAX,
 					__entry->bRequestType,
 					__entry->bRequest, __entry->wValue,
 					__entry->wIndex, __entry->wLength)