X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=drivers%2Fusb%2Fgadget%2Fether.c;h=193583b437ce74b300211fc8a3545d0b56a57b78;hb=9450ab2ba8d720bd9f73bccc0af2e2b5a2c2aaf1;hp=a80486e91f1a7ba4a79d2ff58b94f2f956192515;hpb=2ee87b0c1a5439e4ad6467cb8d5e8fb58922ca4b;p=platform%2Fkernel%2Fu-boot.git diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a80486e..193583b 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1,15 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * ether.c -- Ethernet gadget driver, with CDC and non-CDC options * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger * Copyright (C) 2008 Nokia Corporation - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include +#include #include #include #include @@ -71,11 +71,6 @@ unsigned packet_received, packet_sent; * RNDIS specs are ambiguous and appear to be incomplete, and are also * needlessly complex. They borrow more from CDC ACM than CDC ECM. */ -#define ETH_ALEN 6 /* Octets in one ethernet addr */ -#define ETH_HLEN 14 /* Total octets in header. */ -#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ -#define ETH_DATA_LEN 1500 /* Max. octets in payload */ -#define ETH_FRAME_LEN PKTSIZE_ALIGN /* Max. octets in frame sans FCS */ #define DRIVER_DESC "Ethernet Gadget" /* Based on linux 2.6.27 version */ @@ -105,7 +100,7 @@ struct eth_dev { struct usb_gadget *gadget; struct usb_request *req; /* for control responses */ struct usb_request *stat_req; /* for cdc & rndis status */ -#ifdef CONFIG_DM_USB +#if CONFIG_IS_ENABLED(DM_USB) struct udevice *usb_udev; #endif @@ -529,7 +524,7 @@ static const struct usb_cdc_ether_desc ether_desc = { /* this descriptor actually adds value, surprise! */ .iMACAddress = STRING_ETHADDR, .bmEthernetStatistics = __constant_cpu_to_le32(0), /* no statistics */ - .wMaxSegmentSize = __constant_cpu_to_le16(ETH_FRAME_LEN), + .wMaxSegmentSize = __constant_cpu_to_le16(PKTSIZE_ALIGN), .wNumberMCFilters = __constant_cpu_to_le16(0), .bNumberPowerFilters = 0, }; @@ -1575,7 +1570,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req) req->length -= length; req->actual -= length; } - if (req->actual < ETH_HLEN || ETH_FRAME_LEN < req->actual) { + if (req->actual < ETH_HLEN || PKTSIZE_ALIGN < req->actual) { length_err: dev->stats.rx_errors++; dev->stats.rx_length_errors++; @@ -2342,7 +2337,7 @@ fail: /*-------------------------------------------------------------------------*/ -#ifdef CONFIG_DM_USB +#if CONFIG_IS_ENABLED(DM_USB) int dm_usb_init(struct eth_dev *e_dev) { struct udevice *dev = NULL; @@ -2367,7 +2362,7 @@ static int _usb_eth_init(struct ether_priv *priv) unsigned long ts; unsigned long timeout = USB_CONNECT_TIMEOUT; -#ifdef CONFIG_DM_USB +#if CONFIG_IS_ENABLED(DM_USB) if (dm_usb_init(dev)) { pr_err("USB ether not found\n"); return -ENODEV; @@ -2546,7 +2541,7 @@ void _usb_eth_halt(struct ether_priv *priv) } usb_gadget_unregister_driver(&priv->eth_driver); -#ifndef CONFIG_DM_USB +#if !CONFIG_IS_ENABLED(DM_USB) board_usb_cleanup(0, USB_INIT_DEVICE); #endif }