tg3: Refine tg3_vlan_rx_register()
authorMatt Carlson <mcarlson@broadcom.com>
Wed, 25 Feb 2009 14:23:56 +0000 (14:23 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Feb 2009 07:16:33 +0000 (23:16 -0800)
tg3_vlan_rx_register() touches the hardware if netif_running() returns
false.  This patch fixes the problem.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c

index 0ea61f7f6203c61f123c5a94ac1a179840c2c61c..ce29097cc759ba73a89fa8b3ded8cd1e957efe08 100644 (file)
@@ -9896,8 +9896,12 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 {
        struct tg3 *tp = netdev_priv(dev);
 
-       if (netif_running(dev))
-               tg3_netif_stop(tp);
+       if (!netif_running(dev)) {
+               tp->vlgrp = grp;
+               return;
+       }
+
+       tg3_netif_stop(tp);
 
        tg3_full_lock(tp, 0);
 
@@ -9906,8 +9910,7 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
        /* Update RX_MODE_KEEP_VLAN_TAG bit in RX_MODE register. */
        __tg3_set_rx_mode(dev);
 
-       if (netif_running(dev))
-               tg3_netif_start(tp);
+       tg3_netif_start(tp);
 
        tg3_full_unlock(tp);
 }