drivers: usb: gadget: ether/rndis: convert driver to adopt device driver model
[oweals/u-boot.git] / drivers / usb / gadget / rndis.c
index 62c9b2ead74868e5bcefbe0273c608e98bce6d19..5ad481302b49946b18e052a6039022ab482ba5e9 100644 (file)
@@ -4,10 +4,6 @@
  * 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.
  *
@@ -19,6 +15,8 @@
  *
  * Copyright (C) 2004 by David Brownell
  *             updates to merge with Linux 2.6, better match RNDIS spec
+ *
+ * SPDX-License-Identifier:    GPL-2.0
  */
 
 #include <common.h>
@@ -30,7 +28,7 @@
 
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 
 #undef RNDIS_PM
 #undef RNDIS_WAKEUP
@@ -43,8 +41,6 @@
 #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
@@ -1125,7 +1121,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 +1153,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)