]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tg3: Remove unneeded link_config.orig_... members
authorMatt Carlson <mcarlson@broadcom.com>
Mon, 13 Feb 2012 15:20:15 +0000 (15:20 +0000)
committerJoe Jin <joe.jin@oracle.com>
Tue, 28 Aug 2012 07:21:34 +0000 (15:21 +0800)
This patch removes the unneeded link_config.orig_* members.  When the
phy is in a low power state, the TG3_PHYFLG_IS_LOW_POWER flag solely
determines how the link is configured.  When the phy is powered back up,
it can resume using the original settings.

For the phylib case, the link configuration still needs to be saved, but
since the phylib maintains its own configuration, we can repurpose the
(unused in this case) tg3 link configuration members.

(cherry picked from commit c6700ce2248ecf3b1b6fd009f6aed9b6387d3377)
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/tg3.c
drivers/net/tg3.h

index 097691688e89a127a9641c0461324b03953ae6b8..7302dc0bc2c0f018a2b8285e2e419ac4850cca4c 100644 (file)
@@ -1898,10 +1898,10 @@ static void tg3_phy_start(struct tg3 *tp)
 
        if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
                tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
-               phydev->speed = tp->link_config.orig_speed;
-               phydev->duplex = tp->link_config.orig_duplex;
-               phydev->autoneg = tp->link_config.orig_autoneg;
-               phydev->advertising = tp->link_config.orig_advertising;
+               phydev->speed = tp->link_config.speed;
+               phydev->duplex = tp->link_config.duplex;
+               phydev->autoneg = tp->link_config.autoneg;
+               phydev->advertising = tp->link_config.advertising;
        }
 
        phy_start(phydev);
@@ -3568,10 +3568,10 @@ static int tg3_power_down_prepare(struct tg3 *tp)
 
                        tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
 
-                       tp->link_config.orig_speed = phydev->speed;
-                       tp->link_config.orig_duplex = phydev->duplex;
-                       tp->link_config.orig_autoneg = phydev->autoneg;
-                       tp->link_config.orig_advertising = phydev->advertising;
+                       tp->link_config.speed = phydev->speed;
+                       tp->link_config.duplex = phydev->duplex;
+                       tp->link_config.autoneg = phydev->autoneg;
+                       tp->link_config.advertising = phydev->advertising;
 
                        advertising = ADVERTISED_TP |
                                      ADVERTISED_Pause |
@@ -3604,12 +3604,8 @@ static int tg3_power_down_prepare(struct tg3 *tp)
        } else {
                do_low_power = true;
 
-               if (!(tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) {
+               if (!(tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER))
                        tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
-                       tp->link_config.orig_speed = tp->link_config.speed;
-                       tp->link_config.orig_duplex = tp->link_config.duplex;
-                       tp->link_config.orig_autoneg = tp->link_config.autoneg;
-               }
 
                if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
                        tg3_setup_phy(tp, 0);
@@ -9266,12 +9262,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
        }
 
        if (!tg3_flag(tp, USE_PHYLIB)) {
-               if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
+               if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
                        tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
-                       tp->link_config.speed = tp->link_config.orig_speed;
-                       tp->link_config.duplex = tp->link_config.orig_duplex;
-                       tp->link_config.autoneg = tp->link_config.orig_autoneg;
-               }
 
                err = tg3_setup_phy(tp, 0);
                if (err)
@@ -10620,10 +10612,6 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                tp->link_config.duplex = cmd->duplex;
        }
 
-       tp->link_config.orig_speed = tp->link_config.speed;
-       tp->link_config.orig_duplex = tp->link_config.duplex;
-       tp->link_config.orig_autoneg = tp->link_config.autoneg;
-
        if (netif_running(dev))
                tg3_setup_phy(tp, 1);
 
@@ -10870,10 +10858,10 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
                        if (!epause->autoneg)
                                tg3_setup_flow_control(tp, 0, 0);
                } else {
-                       tp->link_config.orig_advertising &=
+                       tp->link_config.advertising &=
                                        ~(ADVERTISED_Pause |
                                          ADVERTISED_Asym_Pause);
-                       tp->link_config.orig_advertising |= newadv;
+                       tp->link_config.advertising |= newadv;
                }
        } else {
                int irq_sync = 0;
@@ -13369,9 +13357,6 @@ static void __devinit tg3_phy_init_link_config(struct tg3 *tp)
        tp->link_config.autoneg = AUTONEG_ENABLE;
        tp->link_config.active_speed = SPEED_INVALID;
        tp->link_config.active_duplex = DUPLEX_INVALID;
-       tp->link_config.orig_speed = SPEED_INVALID;
-       tp->link_config.orig_duplex = DUPLEX_INVALID;
-       tp->link_config.orig_autoneg = AUTONEG_INVALID;
 }
 
 static int __devinit tg3_phy_probe(struct tg3 *tp)
index 1bd271d3dc7462b998744d3fd5475285de0aeaae..ed2ab7c98cbac88113de56804be5d331931c1111 100644 (file)
@@ -2703,14 +2703,6 @@ struct tg3_link_config {
 #define AUTONEG_INVALID                0xff
        u16                             active_speed;
        u32                             rmt_adv;
-
-       /* When we go in and out of low power mode we need
-        * to swap with this state.
-        */
-       u16                             orig_speed;
-       u8                              orig_duplex;
-       u8                              orig_autoneg;
-       u32                             orig_advertising;
 };
 
 struct tg3_bufmgr_config {