Commit 04bd5926 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Ben Hutchings

usb: gadget: uvc: Fix endianness mismatches

commit e102609f upstream.

The struct usb_endpoint_descriptor wMaxPacketSize field the struct
usb_ss_ep_comp_descriptor wBytesPerInterval field are stored in
little-endian format. Convert the values from CPU order to little endian
before storing the values.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 258c252b
...@@ -611,19 +611,21 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -611,19 +611,21 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
max_packet_size = streaming_maxpacket / 3; max_packet_size = streaming_maxpacket / 3;
} }
uvc_fs_streaming_ep.wMaxPacketSize = min(streaming_maxpacket, 1023U); uvc_fs_streaming_ep.wMaxPacketSize =
cpu_to_le16(min(streaming_maxpacket, 1023U));
uvc_fs_streaming_ep.bInterval = streaming_interval; uvc_fs_streaming_ep.bInterval = streaming_interval;
uvc_hs_streaming_ep.wMaxPacketSize = max_packet_size; uvc_hs_streaming_ep.wMaxPacketSize =
uvc_hs_streaming_ep.wMaxPacketSize |= ((max_packet_mult - 1) << 11); cpu_to_le16(max_packet_size | ((max_packet_mult - 1) << 11));
uvc_hs_streaming_ep.bInterval = streaming_interval; uvc_hs_streaming_ep.bInterval = streaming_interval;
uvc_ss_streaming_ep.wMaxPacketSize = max_packet_size; uvc_ss_streaming_ep.wMaxPacketSize = cpu_to_le16(max_packet_size);
uvc_ss_streaming_ep.bInterval = streaming_interval; uvc_ss_streaming_ep.bInterval = streaming_interval;
uvc_ss_streaming_comp.bmAttributes = max_packet_mult - 1; uvc_ss_streaming_comp.bmAttributes = max_packet_mult - 1;
uvc_ss_streaming_comp.bMaxBurst = streaming_maxburst; uvc_ss_streaming_comp.bMaxBurst = streaming_maxburst;
uvc_ss_streaming_comp.wBytesPerInterval = uvc_ss_streaming_comp.wBytesPerInterval =
max_packet_size * max_packet_mult * streaming_maxburst; cpu_to_le16(max_packet_size * max_packet_mult *
streaming_maxburst);
/* Allocate endpoints. */ /* Allocate endpoints. */
ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep); ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment