OSDN Git Service

usb: gadget: composite: remove duplicated code in OS desc handling
authorChris Dickens <christopher.a.dickens@gmail.com>
Mon, 1 Jan 2018 02:59:43 +0000 (18:59 -0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 8 Mar 2018 13:12:01 +0000 (15:12 +0200)
commit636ba13aec8a0198d3fa4e2246e291a19694b50f
treee1afdf90a059f69d77a1945cb99e1e2e02e805bb
parent5d6ae4f0da8a64a185074dabb1b2f8c148efa741
usb: gadget: composite: remove duplicated code in OS desc handling

When the host wants to fetch OS descriptors, it sends two requests. The
first is only for the header and the second for the full amount
specified by the header in the first request. The OS descriptor handling
code is distinguishing the header-only requests based on the wLength of
the setup packet, but the same code is executed in both cases to
construct the actual header. Simplify this by always constructing the
header and then filling out the rest of the request if the wLength is
greater than the size of the header.

Also remove the duplicate code for queueing the request to ep0 by adding
a goto label.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/composite.c