Re: [PATCH 5/5] usb: dwc3: Endianness issue on dwc3_log_ctrl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Youn <johnyoun@xxxxxxxxxxxx> writes:
> Sparse complains even though it looks ok. Probably it cannot detect that
> the wValue, wIndex, and wLength are declared __le16 due to the macro
> magic.

should we fix sparse, instead? Oh well, doesn't hurt applying.

>
> Redeclare them as CPU endianness and make the conversion on assignment.
>
> Signed-off-by: John Youn <johnyoun@xxxxxxxxxxxx>
> ---
>  drivers/usb/dwc3/trace.h | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
> index 3ac7252..d0461eb 100644
> --- a/drivers/usb/dwc3/trace.h
> +++ b/drivers/usb/dwc3/trace.h
> @@ -85,21 +85,21 @@ DECLARE_EVENT_CLASS(dwc3_log_ctrl,
>  	TP_STRUCT__entry(
>  		__field(__u8, bRequestType)
>  		__field(__u8, bRequest)
> -		__field(__le16, wValue)
> -		__field(__le16, wIndex)
> -		__field(__le16, wLength)
> +		__field(__u16, wValue)
> +		__field(__u16, wIndex)
> +		__field(__u16, wLength)
>  	),
>  	TP_fast_assign(
>  		__entry->bRequestType = ctrl->bRequestType;
>  		__entry->bRequest = ctrl->bRequest;
> -		__entry->wValue = ctrl->wValue;
> -		__entry->wIndex = ctrl->wIndex;
> -		__entry->wLength = ctrl->wLength;
> +		__entry->wValue = le16_to_cpu(ctrl->wValue);
> +		__entry->wIndex = le16_to_cpu(ctrl->wIndex);
> +		__entry->wLength = le16_to_cpu(ctrl->wLength);
>  	),
>  	TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
>  		__entry->bRequestType, __entry->bRequest,
> -		le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex),
> -		le16_to_cpu(__entry->wLength)
> +		__entry->wValue, __entry->wIndex,
> +		__entry->wLength
>  	)
>  );
>  
> -- 
> 2.8.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux