net: set name_assign_type in alloc_netdev()
[linux-block.git] / drivers / net / ethernet / tile / tilegx.c
index 449011b0e007d6b798a91728eaa845e05e581305..69557a26f7498ae261cc232f91ae0f5aeeb283f1 100644 (file)
@@ -2191,8 +2191,6 @@ static void tile_net_setup(struct net_device *dev)
 static void tile_net_dev_init(const char *name, const uint8_t *mac)
 {
        int ret;
-       int i;
-       int nz_addr = 0;
        struct net_device *dev;
        struct tile_net_priv *priv;
 
@@ -2203,8 +2201,8 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
        /* Allocate the device structure.  Normally, "name" is a
         * template, instantiated by register_netdev(), but not for us.
         */
-       dev = alloc_netdev_mqs(sizeof(*priv), name, tile_net_setup,
-                              NR_CPUS, 1);
+       dev = alloc_netdev_mqs(sizeof(*priv), name, NET_NAME_UNKNOWN,
+                              tile_net_setup, NR_CPUS, 1);
        if (!dev) {
                pr_err("alloc_netdev_mqs(%s) failed\n", name);
                return;
@@ -2212,7 +2210,6 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
 
        /* Initialize "priv". */
        priv = netdev_priv(dev);
-       memset(priv, 0, sizeof(*priv));
        priv->dev = dev;
        priv->channel = -1;
        priv->loopify_channel = -1;
@@ -2223,15 +2220,10 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
         * be done before the device is opened.  If the MAC is all zeroes,
         * we use a random address, since we're probably on the simulator.
         */
-       for (i = 0; i < 6; i++)
-               nz_addr |= mac[i];
-
-       if (nz_addr) {
-               memcpy(dev->dev_addr, mac, ETH_ALEN);
-               dev->addr_len = 6;
-       } else {
+       if (!is_zero_ether_addr(mac))
+               ether_addr_copy(dev->dev_addr, mac);
+       else
                eth_hw_addr_random(dev);
-       }
 
        /* Register the network device. */
        ret = register_netdev(dev);