Merge branch '2020-05-08-assorted-fixes'
[oweals/u-boot.git] / drivers / usb / gadget / rndis.c
index 62c9b2ead74868e5bcefbe0273c608e98bce6d19..eec639f8c07fa1b28bbf4335fa14922937b6127b 100644 (file)
@@ -1,13 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * RNDIS MSG parser
  *
  * Authors:    Benedikt Spranger, Pengutronix
  *             Robert Schwebel, Pengutronix
  *
- *              This program is free software; you can redistribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              version 2, as published by the Free Software Foundation.
- *
  *             This software was originally developed in conformance with
  *             Microsoft's Remote NDIS Specification License Agreement.
  *
@@ -30,7 +27,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 
 #undef RNDIS_PM
 #undef RNDIS_WAKEUP
 
 #include "rndis.h"
 
-#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 ENOTSUPP        524     /* Operation is not supported */
-
-
 /*
  * The driver for your USB chip needs to support ep0 OUT to work with
  * RNDIS, plus all three CDC Ethernet endpoints (interrupt not optional).
@@ -1125,7 +1114,11 @@ int rndis_msg_parser(u8 configNr, u8 *buf)
        return -ENOTSUPP;
 }
 
+#ifndef CONFIG_DM_ETH
 int rndis_register(int (*rndis_control_ack)(struct eth_device *))
+#else
+int rndis_register(int (*rndis_control_ack)(struct udevice *))
+#endif
 {
        u8 i;
 
@@ -1153,8 +1146,13 @@ void rndis_deregister(int configNr)
        return;
 }
 
-int rndis_set_param_dev(u8 configNr, struct eth_device *dev, int mtu,
-                       struct net_device_stats *stats, u16 *cdc_filter)
+#ifndef CONFIG_DM_ETH
+int  rndis_set_param_dev(u8 configNr, struct eth_device *dev, int mtu,
+                        struct net_device_stats *stats, u16 *cdc_filter)
+#else
+int  rndis_set_param_dev(u8 configNr, struct udevice *dev, int mtu,
+                        struct net_device_stats *stats, u16 *cdc_filter)
+#endif
 {
        debug("%s: configNr = %d\n", __func__, configNr);
        if (!dev || !stats)