mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-20 19:43:58 +08:00
cdc-wdm: use the common CDC parser
Now that the common parser resides in USB core, it can be used for CDC-WDM. Signed-off-by: Oliver Neukum <ONeukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6dd3587f51
commit
7fae7bfb9a
@ -875,38 +875,18 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
|||||||
int rv = -EINVAL;
|
int rv = -EINVAL;
|
||||||
struct usb_host_interface *iface;
|
struct usb_host_interface *iface;
|
||||||
struct usb_endpoint_descriptor *ep;
|
struct usb_endpoint_descriptor *ep;
|
||||||
struct usb_cdc_dmm_desc *dmhd;
|
struct usb_cdc_parsed_header hdr;
|
||||||
u8 *buffer = intf->altsetting->extra;
|
u8 *buffer = intf->altsetting->extra;
|
||||||
int buflen = intf->altsetting->extralen;
|
int buflen = intf->altsetting->extralen;
|
||||||
u16 maxcom = WDM_DEFAULT_BUFSIZE;
|
u16 maxcom = WDM_DEFAULT_BUFSIZE;
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
goto err;
|
goto err;
|
||||||
while (buflen > 2) {
|
|
||||||
if (buffer[1] != USB_DT_CS_INTERFACE) {
|
|
||||||
dev_err(&intf->dev, "skipping garbage\n");
|
|
||||||
goto next_desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (buffer[2]) {
|
cdc_parse_cdc_header(&hdr, intf, buffer, buflen);
|
||||||
case USB_CDC_HEADER_TYPE:
|
|
||||||
break;
|
if (hdr.usb_cdc_dmm_desc)
|
||||||
case USB_CDC_DMM_TYPE:
|
maxcom = le16_to_cpu(hdr.usb_cdc_dmm_desc->wMaxCommand);
|
||||||
dmhd = (struct usb_cdc_dmm_desc *)buffer;
|
|
||||||
maxcom = le16_to_cpu(dmhd->wMaxCommand);
|
|
||||||
dev_dbg(&intf->dev,
|
|
||||||
"Finding maximum buffer length: %d", maxcom);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev_err(&intf->dev,
|
|
||||||
"Ignoring extra header, type %d, length %d\n",
|
|
||||||
buffer[2], buffer[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
next_desc:
|
|
||||||
buflen -= buffer[0];
|
|
||||||
buffer += buffer[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
iface = intf->cur_altsetting;
|
iface = intf->cur_altsetting;
|
||||||
if (iface->desc.bNumEndpoints != 1)
|
if (iface->desc.bNumEndpoints != 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user