]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - net/eth.c
mip405.c: Fix GCC 4.6 build warnings
[karo-tx-uboot.git] / net / eth.c
index a34fe59383f38bc40a830c2628d191960c4396d3..4280d6dbe77eff5f7e19e445f2a32ad75242e734 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -62,8 +62,6 @@ int eth_getenv_enetaddr_by_index(const char *base_name, int index,
        return eth_getenv_enetaddr(enetvar, enetaddr);
 }
 
-#ifdef CONFIG_NET_MULTI
-
 static int eth_mac_skip(int index)
 {
        char enetvar[15];
@@ -108,6 +106,8 @@ struct eth_device *eth_get_dev_by_name(const char *devname)
 {
        struct eth_device *dev, *target_dev;
 
+       BUG_ON(devname == NULL);
+
        if (!eth_devices)
                return NULL;
 
@@ -170,23 +170,18 @@ int eth_get_dev_index (void)
 
 static void eth_current_changed(void)
 {
-#ifdef CONFIG_NET_MULTI
-       {
-               char *act = getenv("ethact");
-               /* update current ethernet name */
-               if (eth_current)
-               {
-                       if (act == NULL || strcmp(act, eth_current->name) != 0)
-                               setenv("ethact", eth_current->name);
-               }
-               /*
-                * remove the variable completely if there is no active
-                * interface
-                */
-               else if (act != NULL)
-                       setenv("ethact", NULL);
+       char *act = getenv("ethact");
+       /* update current ethernet name */
+       if (eth_current) {
+               if (act == NULL || strcmp(act, eth_current->name) != 0)
+                       setenv("ethact", eth_current->name);
        }
-#endif
+       /*
+        * remove the variable completely if there is no active
+        * interface
+        */
+       else if (act != NULL)
+               setenv("ethact", NULL);
 }
 
 int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
@@ -224,6 +219,9 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 int eth_register(struct eth_device *dev)
 {
        struct eth_device *d;
+
+       assert(strlen(dev->name) < NAMESIZE);
+
        if (!eth_devices) {
                eth_current = eth_devices = dev;
                eth_current_changed();
@@ -296,8 +294,8 @@ int eth_initialize(bd_t *bis)
                        if (strchr(dev->name, ' '))
                                puts("\nWarning: eth device name has a space!\n");
 
-                       if (eth_write_hwaddr(dev, NULL, eth_number))
-                               puts("Warning: failed to set MAC address\n");
+                       if (eth_write_hwaddr(dev, "eth", eth_number))
+                               puts("\nWarning: failed to set MAC address\n");
 
                        eth_number++;
                        dev = dev->next;
@@ -530,27 +528,3 @@ char *eth_get_name (void)
 {
        return (eth_current ? eth_current->name : "unknown");
 }
-
-#else /* !CONFIG_NET_MULTI */
-
-#warning Ethernet driver is deprecated.  Please update to use CONFIG_NET_MULTI
-
-extern int mcf52x2_miiphy_initialize(bd_t *bis);
-extern int ns7520_miiphy_initialize(bd_t *bis);
-
-
-int eth_initialize(bd_t *bis)
-{
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
-       miiphy_init();
-#endif
-
-#if defined(CONFIG_MCF52x2)
-       mcf52x2_miiphy_initialize(bis);
-#endif
-#if defined(CONFIG_DRIVER_NS7520_ETHERNET)
-       ns7520_miiphy_initialize(bis);
-#endif
-       return 0;
-}
-#endif