net/ethernet: remove useless is_valid_ether_addr from drivers ndo_open
authorJoachim Eastwood <manabian@gmail.com>
Fri, 16 Nov 2012 04:47:15 +0000 (04:47 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Nov 2012 00:01:18 +0000 (19:01 -0500)
If ndo_validate_addr is set to the generic eth_validate_addr
function there is no point in calling is_valid_ether_addr
from driver ndo_open if ndo_open is not used elsewhere in
the driver.

With this change is_valid_ether_addr will be called from the
generic eth_validate_addr function. So there should be no change
in the actual behavior.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 files changed:
drivers/net/ethernet/8390/etherh.c
drivers/net/ethernet/cadence/at91_ether.c
drivers/net/ethernet/cadence/macb.c
drivers/net/ethernet/dnet.c
drivers/net/ethernet/i825xx/ether1.c
drivers/net/ethernet/micrel/ks8695net.c
drivers/net/ethernet/nxp/lpc_eth.c
drivers/net/ethernet/seeq/ether3.c
drivers/net/ethernet/smsc/smc911x.c
drivers/net/ethernet/smsc/smc91x.c
drivers/net/ethernet/smsc/smsc911x.c
drivers/net/ethernet/wiznet/w5100.c
drivers/net/ethernet/wiznet/w5300.c

index 8322c54972f3668710c8418c8cf02fb0526cabfe..6414e84516c0f7c4c076d009c33014ad902ba392 100644 (file)
@@ -463,12 +463,6 @@ etherh_open(struct net_device *dev)
 {
        struct ei_device *ei_local = netdev_priv(dev);
 
-       if (!is_valid_ether_addr(dev->dev_addr)) {
-               printk(KERN_WARNING "%s: invalid ethernet MAC address\n",
-                       dev->name);
-               return -EINVAL;
-       }
-
        if (request_irq(dev->irq, __ei_interrupt, 0, dev->name, dev))
                return -EAGAIN;
 
index e7a476cff6c593bbca3fea54746b2bab133f4a95..716cc014a56e289c153374736ed122200b7928d1 100644 (file)
@@ -97,9 +97,6 @@ static int at91ether_open(struct net_device *dev)
        u32 ctl;
        int ret;
 
-       if (!is_valid_ether_addr(dev->dev_addr))
-               return -EADDRNOTAVAIL;
-
        /* Clear internal statistics */
        ctl = macb_readl(lp, NCR);
        macb_writel(lp, NCR, ctl | MACB_BIT(CLRSTAT));
index 27991ddb6ff00554ed9d55f797a32c7e01171c6b..cc6e593dd65a92754b4e904934bfb92a08ea5255 100644 (file)
@@ -1215,9 +1215,6 @@ static int macb_open(struct net_device *dev)
        if (!bp->phy_dev)
                return -EAGAIN;
 
-       if (!is_valid_ether_addr(dev->dev_addr))
-               return -EADDRNOTAVAIL;
-
        err = macb_alloc_consistent(bp);
        if (err) {
                netdev_err(dev, "Unable to allocate DMA memory (error %d)\n",
index 290b26f868c9f7d358c125822dd67bc412d85b16..feb5095d81b70e0ce80f55bf34801a088c85ffc3 100644 (file)
@@ -664,9 +664,6 @@ static int dnet_open(struct net_device *dev)
        if (!bp->phy_dev)
                return -EAGAIN;
 
-       if (!is_valid_ether_addr(dev->dev_addr))
-               return -EADDRNOTAVAIL;
-
        napi_enable(&bp->napi);
        dnet_init_hw(bp);
 
index 067db3f13e918ddc7ac896ab0212e20921fd8d31..7b9609da6fe48a62ab315d31d04012a1cb6c30e4 100644 (file)
@@ -638,12 +638,6 @@ ether1_txalloc (struct net_device *dev, int size)
 static int
 ether1_open (struct net_device *dev)
 {
-       if (!is_valid_ether_addr(dev->dev_addr)) {
-               printk(KERN_WARNING "%s: invalid ethernet MAC address\n",
-                       dev->name);
-               return -EINVAL;
-       }
-
        if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
                return -EAGAIN;
 
index dccae1d1743a6241679d2ece28528736404b59e6..e62c31234cfae22be452f084de18446ab28a6541 100644 (file)
@@ -1249,9 +1249,6 @@ ks8695_open(struct net_device *ndev)
        struct ks8695_priv *ksp = netdev_priv(ndev);
        int ret;
 
-       if (!is_valid_ether_addr(ndev->dev_addr))
-               return -EADDRNOTAVAIL;
-
        ks8695_reset(ksp);
 
        ks8695_update_mac(ksp);
index af8b4142088c3d6a9114fd8c218336f54fcbcc19..db6e1019be185661dd56f039f05069fbb2736e90 100644 (file)
@@ -1219,9 +1219,6 @@ static int lpc_eth_open(struct net_device *ndev)
        if (netif_msg_ifup(pldat))
                dev_dbg(&pldat->pdev->dev, "enabling %s\n", ndev->name);
 
-       if (!is_valid_ether_addr(ndev->dev_addr))
-               return -EADDRNOTAVAIL;
-
        __lpc_eth_clock_enable(pldat, true);
 
        /* Reset and initialize */
@@ -1301,6 +1298,7 @@ static const struct net_device_ops lpc_netdev_ops = {
        .ndo_set_rx_mode        = lpc_eth_set_multicast_list,
        .ndo_do_ioctl           = lpc_eth_ioctl,
        .ndo_set_mac_address    = lpc_set_mac_address,
+       .ndo_validate_addr      = eth_validate_addr,
        .ndo_change_mtu         = eth_change_mtu,
 };
 
index 6a40dd03a32f16b2289db8605daf1f77e564a3f8..72a01748d1b1a14a4698edf50937693c52524393 100644 (file)
@@ -399,12 +399,6 @@ ether3_probe_bus_16(struct net_device *dev, int val)
 static int
 ether3_open(struct net_device *dev)
 {
-       if (!is_valid_ether_addr(dev->dev_addr)) {
-               printk(KERN_WARNING "%s: invalid ethernet MAC address\n",
-                       dev->name);
-               return -EINVAL;
-       }
-
        if (request_irq(dev->irq, ether3_interrupt, 0, "ether3", dev))
                return -EAGAIN;
 
index 8d15f7a74b4520cc57d43a034900cc76fcc25282..990f57467a15ba5b28c0f6f9fe2ba1987e408c71 100644 (file)
@@ -1400,16 +1400,6 @@ smc911x_open(struct net_device *dev)
 
        DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __func__);
 
-       /*
-        * Check that the address is valid.  If its not, refuse
-        * to bring the device up.       The user must specify an
-        * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
-        */
-       if (!is_valid_ether_addr(dev->dev_addr)) {
-               PRINTK("%s: no valid ethernet hw addr\n", __func__);
-               return -EINVAL;
-       }
-
        /* reset the hardware */
        smc911x_reset(dev);
 
index 318adc935a53f72db7a354888aa5b5f65e11bf69..f516e5a71c53695b4235ce1673d49bdc733a82be 100644 (file)
@@ -1474,16 +1474,6 @@ smc_open(struct net_device *dev)
 
        DBG(2, "%s: %s\n", dev->name, __func__);
 
-       /*
-        * Check that the address is valid.  If its not, refuse
-        * to bring the device up.  The user must specify an
-        * address using ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
-        */
-       if (!is_valid_ether_addr(dev->dev_addr)) {
-               PRINTK("%s: no valid ethernet hw addr\n", __func__);
-               return -EINVAL;
-       }
-
        /* Setup the default Register Modes */
        lp->tcr_cur_mode = TCR_DEFAULT;
        lp->rcr_cur_mode = RCR_DEFAULT;
index c53c0f4e2ce311cc5083d218bff9f5d1ed8e56e0..cc025620b6817816e6abd47b4b6df7c5b832473d 100644 (file)
@@ -1463,11 +1463,6 @@ static int smsc911x_open(struct net_device *dev)
                return -EAGAIN;
        }
 
-       if (!is_valid_ether_addr(dev->dev_addr)) {
-               SMSC_WARN(pdata, hw, "dev_addr is not a valid MAC address");
-               return -EADDRNOTAVAIL;
-       }
-
        /* Reset the LAN911x */
        if (smsc911x_soft_reset(pdata)) {
                SMSC_WARN(pdata, hw, "soft reset failed");
index 2c08bf6e7bf3b326f828585a3a8fefc96d62ddb3..7daf92e56b655480fce6c3e6e91aadc0da03a3bb 100644 (file)
@@ -580,8 +580,6 @@ static int w5100_open(struct net_device *ndev)
        struct w5100_priv *priv = netdev_priv(ndev);
 
        netif_info(priv, ifup, ndev, "enabling\n");
-       if (!is_valid_ether_addr(ndev->dev_addr))
-               return -EINVAL;
        w5100_hw_start(priv);
        napi_enable(&priv->napi);
        netif_start_queue(ndev);
index 88943d90c7653565283a064e3a8ed25f65d5d213..bd9eec676a58c2516f07841408b2ba6f9e378893 100644 (file)
@@ -500,8 +500,6 @@ static int w5300_open(struct net_device *ndev)
        struct w5300_priv *priv = netdev_priv(ndev);
 
        netif_info(priv, ifup, ndev, "enabling\n");
-       if (!is_valid_ether_addr(ndev->dev_addr))
-               return -EINVAL;
        w5300_hw_start(priv);
        napi_enable(&priv->napi);
        netif_start_queue(ndev);
This page took 0.045867 seconds and 5 git commands to generate.