Merge tag 'efi-2019-07-rc1' of git://git.denx.de/u-boot-efi
[oweals/u-boot.git] / drivers / net / ne2000_base.c
index 88f2b379f37bbb5f73907d5631b56ed7763c78d7..421aa20ea6af8f876944083b54f745374a12da4f 100644 (file)
@@ -74,8 +74,10 @@ Add SNMP
 
 #include <common.h>
 #include <command.h>
+#include <environment.h>
 #include <net.h>
 #include <malloc.h>
+#include <linux/compiler.h>
 
 /* forward definition of function used for the uboot interface */
 void uboot_push_packet_len(int len);
@@ -279,7 +281,7 @@ dp83902a_send(u8 *data, int total_len, u32 key)
                 * does (i.e., also read data).
                 */
 
-               u16 tmp;
+               __maybe_unused u16 tmp;
                int len = 1;
 
                DP_OUT(base, DP_RSAL, 0x100 - len);
@@ -373,7 +375,7 @@ dp83902a_RxEvent(void)
 {
        struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
        u8 *base = dp->base;
-       u8 rsr;
+       __maybe_unused u8 rsr;
        u8 rcv_hdr[4];
        int i, len, pkt, cur;
 
@@ -494,7 +496,7 @@ dp83902a_recv(u8 *data, int len)
                                        printf(" %02x", tmp);
                                        if (0 == (++dx % 16)) printf("\n ");
 #endif
-                                       *data++ = tmp;;
+                                       *data++ = tmp;
                                        mlen--;
                                }
                        }
@@ -510,7 +512,7 @@ dp83902a_TxEvent(void)
 {
        struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
        u8 *base = dp->base;
-       u8 tsr;
+       __maybe_unused u8 tsr;
        u32 key;
 
        DEBUG_FUNCTION();
@@ -547,7 +549,7 @@ dp83902a_ClearCounters(void)
 {
        struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
        u8 *base = dp->base;
-       u8 cnt1, cnt2, cnt3;
+       __maybe_unused u8 cnt1, cnt2, cnt3;
 
        DP_IN(base, DP_FER, cnt1);
        DP_IN(base, DP_CER, cnt2);
@@ -581,7 +583,7 @@ dp83902a_Overflow(void)
        /*
         * Read in as many packets as we can and acknowledge any and receive
         * interrupts. Since the buffer has overflowed, a receive event of
-        * some kind will have occured.
+        * some kind will have occurred.
         */
        dp83902a_RxEvent();
        DP_OUT(base, DP_ISR, DP_ISR_RxP|DP_ISR_RxE);
@@ -591,7 +593,7 @@ dp83902a_Overflow(void)
        DP_OUT(base, DP_TCR, DP_TCR_NORMAL);
 
        /*
-        * If a transmit command was issued, but no transmit event has occured,
+        * If a transmit command was issued, but no transmit event has occurred,
         * restart it here.
         */
        DP_IN(base, DP_ISR, isr);
@@ -649,7 +651,7 @@ dp83902a_poll(void)
 }
 
 
-/* U-boot specific routines */
+/* U-Boot specific routines */
 static u8 *pbuf = NULL;
 
 static int pkey = -1;
@@ -664,7 +666,7 @@ void uboot_push_packet_len(int len) {
        dp83902a_recv(&pbuf[0], len);
 
        /*Just pass it to the upper layer*/
-       NetReceive(&pbuf[0], len);
+       net_process_received_packet(&pbuf[0], len);
 }
 
 void uboot_push_tx_done(int key, int val) {
@@ -714,15 +716,15 @@ static int ne2k_setup_driver(struct eth_device *dev)
         * to the MAC address value in the environment, so we do not read
         * it from the prom or eeprom if it is specified in the environment.
         */
-       if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr)) {
+       if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr)) {
                /* If the MAC address is not in the environment, get it: */
                if (!get_prom(dev->enetaddr, nic.base)) /* get MAC from prom */
                        dp83902a_init(dev->enetaddr);   /* fallback: seeprom */
                /* And write it into the environment otherwise eth_write_hwaddr
-                * returns -1 due to eth_getenv_enetaddr_by_index() failing,
+                * returns -1 due to eth_env_get_enetaddr_by_index() failing,
                 * and this causes "Warning: failed to set MAC address", and
                 * cmd_bdinfo has no ethaddr value which it can show: */
-               eth_setenv_enetaddr("ethaddr", dev->enetaddr);
+               eth_env_set_enetaddr("ethaddr", dev->enetaddr);
        }
        return 0;
 }
@@ -748,7 +750,7 @@ static int ne2k_recv(struct eth_device *dev)
        return 1;
 }
 
-static int ne2k_send(struct eth_device *dev, volatile void *packet, int length)
+static int ne2k_send(struct eth_device *dev, void *packet, int length)
 {
        int tmo;
 
@@ -793,7 +795,7 @@ int ne2k_register(void)
        dev->send = ne2k_send;
        dev->recv = ne2k_recv;
 
-       sprintf(dev->name, "NE2000");
+       strcpy(dev->name, "NE2000");
 
        return eth_register(dev);
 }