aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-07-24 20:22:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-24 20:22:18 -0400
commitb7545b79a1698b4cbcb5da94c105523b85ee7c90 (patch)
tree6a0de6b494b21957006d2f7e2c3c7638484a9dc8 /drivers/net/usb
parent721413aff218118548b84b18cb5b49660e6e2940 (diff)
parentcb42b63d893d8d22d1739ddea0d86b10fd921aac (diff)
Merge tag 'usb-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB updates from Greg KH: "Here's the big USB driver update for 4.8-rc1. Lots of the normal stuff in here, musb, gadget, xhci, and other updates and fixes. All of the details are in the shortlog. All of these have been in linux-next for a while with no reported issues" * tag 'usb-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (169 commits) cdc-acm: beautify probe() cdc-wdm: use the common CDC parser cdc-acm: cleanup error handling cdc-acm: use the common parser usbnet: move the CDC parser into USB core usb: musb: sunxi: Simplify dr_mode handling usb: musb: sunxi: make unexported symbols static usb: musb: cppi41: add dma channel tracepoints usb: musb: cppi41: move struct cppi41_dma_channel to header usb: musb: cleanup cppi_dma header usb: musb: gadget: add usb-request tracepoints usb: musb: host: add urb tracepoints usb: musb: add tracepoints to dump interrupt events usb: musb: add tracepoints for register access usb: musb: dsps: use musb register read/write wrappers instead usb: musb: switch dev_dbg to tracepoints usb: musb: add tracepoints support for debugging usb: quirks: Add no-lpm quirk for Elan phy: rcar-gen3-usb2: fix mutex_lock calling in interrupt phy: rockhip-usb: use devm_add_action_or_reset() ...
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/usbnet.c138
1 files changed, 0 insertions, 138 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 6086a0163249..3bfb59209326 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -42,7 +42,6 @@
42#include <linux/mii.h> 42#include <linux/mii.h>
43#include <linux/usb.h> 43#include <linux/usb.h>
44#include <linux/usb/usbnet.h> 44#include <linux/usb/usbnet.h>
45#include <linux/usb/cdc.h>
46#include <linux/slab.h> 45#include <linux/slab.h>
47#include <linux/kernel.h> 46#include <linux/kernel.h>
48#include <linux/pm_runtime.h> 47#include <linux/pm_runtime.h>
@@ -1972,143 +1971,6 @@ out:
1972 return err; 1971 return err;
1973} 1972}
1974 1973
1975int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
1976 struct usb_interface *intf,
1977 u8 *buffer,
1978 int buflen)
1979{
1980 /* duplicates are ignored */
1981 struct usb_cdc_union_desc *union_header = NULL;
1982
1983 /* duplicates are not tolerated */
1984 struct usb_cdc_header_desc *header = NULL;
1985 struct usb_cdc_ether_desc *ether = NULL;
1986 struct usb_cdc_mdlm_detail_desc *detail = NULL;
1987 struct usb_cdc_mdlm_desc *desc = NULL;
1988
1989 unsigned int elength;
1990 int cnt = 0;
1991
1992 memset(hdr, 0x00, sizeof(struct usb_cdc_parsed_header));
1993 hdr->phonet_magic_present = false;
1994 while (buflen > 0) {
1995 elength = buffer[0];
1996 if (!elength) {
1997 dev_err(&intf->dev, "skipping garbage byte\n");
1998 elength = 1;
1999 goto next_desc;
2000 }
2001 if (buffer[1] != USB_DT_CS_INTERFACE) {
2002 dev_err(&intf->dev, "skipping garbage\n");
2003 goto next_desc;
2004 }
2005
2006 switch (buffer[2]) {
2007 case USB_CDC_UNION_TYPE: /* we've found it */
2008 if (elength < sizeof(struct usb_cdc_union_desc))
2009 goto next_desc;
2010 if (union_header) {
2011 dev_err(&intf->dev, "More than one union descriptor, skipping ...\n");
2012 goto next_desc;
2013 }
2014 union_header = (struct usb_cdc_union_desc *)buffer;
2015 break;
2016 case USB_CDC_COUNTRY_TYPE:
2017 if (elength < sizeof(struct usb_cdc_country_functional_desc))
2018 goto next_desc;
2019 hdr->usb_cdc_country_functional_desc =
2020 (struct usb_cdc_country_functional_desc *)buffer;
2021 break;
2022 case USB_CDC_HEADER_TYPE:
2023 if (elength != sizeof(struct usb_cdc_header_desc))
2024 goto next_desc;
2025 if (header)
2026 return -EINVAL;
2027 header = (struct usb_cdc_header_desc *)buffer;
2028 break;
2029 case USB_CDC_ACM_TYPE:
2030 if (elength < sizeof(struct usb_cdc_acm_descriptor))
2031 goto next_desc;
2032 hdr->usb_cdc_acm_descriptor =
2033 (struct usb_cdc_acm_descriptor *)buffer;
2034 break;
2035 case USB_CDC_ETHERNET_TYPE:
2036 if (elength != sizeof(struct usb_cdc_ether_desc))
2037 goto next_desc;
2038 if (ether)
2039 return -EINVAL;
2040 ether = (struct usb_cdc_ether_desc *)buffer;
2041 break;
2042 case USB_CDC_CALL_MANAGEMENT_TYPE:
2043 if (elength < sizeof(struct usb_cdc_call_mgmt_descriptor))
2044 goto next_desc;
2045 hdr->usb_cdc_call_mgmt_descriptor =
2046 (struct usb_cdc_call_mgmt_descriptor *)buffer;
2047 break;
2048 case USB_CDC_DMM_TYPE:
2049 if (elength < sizeof(struct usb_cdc_dmm_desc))
2050 goto next_desc;
2051 hdr->usb_cdc_dmm_desc =
2052 (struct usb_cdc_dmm_desc *)buffer;
2053 break;
2054 case USB_CDC_MDLM_TYPE:
2055 if (elength < sizeof(struct usb_cdc_mdlm_desc *))
2056 goto next_desc;
2057 if (desc)
2058 return -EINVAL;
2059 desc = (struct usb_cdc_mdlm_desc *)buffer;
2060 break;
2061 case USB_CDC_MDLM_DETAIL_TYPE:
2062 if (elength < sizeof(struct usb_cdc_mdlm_detail_desc *))
2063 goto next_desc;
2064 if (detail)
2065 return -EINVAL;
2066 detail = (struct usb_cdc_mdlm_detail_desc *)buffer;
2067 break;
2068 case USB_CDC_NCM_TYPE:
2069 if (elength < sizeof(struct usb_cdc_ncm_desc))
2070 goto next_desc;
2071 hdr->usb_cdc_ncm_desc = (struct usb_cdc_ncm_desc *)buffer;
2072 break;
2073 case USB_CDC_MBIM_TYPE:
2074 if (elength < sizeof(struct usb_cdc_mbim_desc))
2075 goto next_desc;
2076
2077 hdr->usb_cdc_mbim_desc = (struct usb_cdc_mbim_desc *)buffer;
2078 break;
2079 case USB_CDC_MBIM_EXTENDED_TYPE:
2080 if (elength < sizeof(struct usb_cdc_mbim_extended_desc))
2081 break;
2082 hdr->usb_cdc_mbim_extended_desc =
2083 (struct usb_cdc_mbim_extended_desc *)buffer;
2084 break;
2085 case CDC_PHONET_MAGIC_NUMBER:
2086 hdr->phonet_magic_present = true;
2087 break;
2088 default:
2089 /*
2090 * there are LOTS more CDC descriptors that
2091 * could legitimately be found here.
2092 */
2093 dev_dbg(&intf->dev, "Ignoring descriptor: type %02x, length %ud\n",
2094 buffer[2], elength);
2095 goto next_desc;
2096 }
2097 cnt++;
2098next_desc:
2099 buflen -= elength;
2100 buffer += elength;
2101 }
2102 hdr->usb_cdc_union_desc = union_header;
2103 hdr->usb_cdc_header_desc = header;
2104 hdr->usb_cdc_mdlm_detail_desc = detail;
2105 hdr->usb_cdc_mdlm_desc = desc;
2106 hdr->usb_cdc_ether_desc = ether;
2107 return cnt;
2108}
2109
2110EXPORT_SYMBOL(cdc_parse_cdc_header);
2111
2112/* 1974/*
2113 * The function can't be called inside suspend/resume callback, 1975 * The function can't be called inside suspend/resume callback,
2114 * otherwise deadlock will be caused. 1976 * otherwise deadlock will be caused.