Skip to content

Commit 5797663

Browse files
bhupesh-sharmaFelipe Balbi
authored andcommitted
usb: gadget: uvc: Use macro for interrupt endpoint status size instead of using a MAGIC number
This patch adds a MACRO for the UVC video control status (interrupt) endpoint and removes the magic number which was being used earlier. Some UDCs have issues supporting an interrupt IN endpoint having a max packet size less than a particular value (say 32). It is easier in that case to simply change the MACRO value instead of changing the max packet size value at a number of locations. Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parent 3de6e63 commit 5797663

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/usb/gadget/f_uvc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ static struct usb_gadget_strings *uvc_function_strings[] = {
5959
#define UVC_INTF_VIDEO_CONTROL 0
6060
#define UVC_INTF_VIDEO_STREAMING 1
6161

62+
#define STATUS_BYTECOUNT 16 /* 16 bytes status */
63+
6264
static struct usb_interface_assoc_descriptor uvc_iad __initdata = {
6365
.bLength = sizeof(uvc_iad),
6466
.bDescriptorType = USB_DT_INTERFACE_ASSOCIATION,
@@ -87,15 +89,15 @@ static struct usb_endpoint_descriptor uvc_control_ep __initdata = {
8789
.bDescriptorType = USB_DT_ENDPOINT,
8890
.bEndpointAddress = USB_DIR_IN,
8991
.bmAttributes = USB_ENDPOINT_XFER_INT,
90-
.wMaxPacketSize = cpu_to_le16(16),
92+
.wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT),
9193
.bInterval = 8,
9294
};
9395

9496
static struct uvc_control_endpoint_descriptor uvc_control_cs_ep __initdata = {
9597
.bLength = UVC_DT_CONTROL_ENDPOINT_SIZE,
9698
.bDescriptorType = USB_DT_CS_ENDPOINT,
9799
.bDescriptorSubType = UVC_EP_INTERRUPT,
98-
.wMaxTransferSize = cpu_to_le16(16),
100+
.wMaxTransferSize = cpu_to_le16(STATUS_BYTECOUNT),
99101
};
100102

101103
static struct usb_interface_descriptor uvc_streaming_intf_alt0 __initdata = {

0 commit comments

Comments
 (0)