diff options
author | Konstantin Khlebnikov <khlebnikov@openvz.org> | 2013-03-05 04:43:09 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2013-03-07 05:55:30 -0500 |
commit | e60b22c5b7e59db09a7c9490b1e132c7e49ae904 (patch) | |
tree | 9e708941b86049dff4fa936117031988a0d7cb7f /drivers/net | |
parent | 66148babe728f3e00e13c56f6b0ecf325abd80da (diff) |
e1000e: fix accessing to suspended device
This patch fixes some annoying messages like 'Error reading PHY register' and
'Hardware Erorr' and saves several seconds on reboot.
Cc: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Borislav Petkov <bp@suse.de>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/ethtool.c | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/netdev.c | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index 2c1813737f6d..f91a8f3f9d48 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/vmalloc.h> | 37 | #include <linux/vmalloc.h> |
38 | #include <linux/mdio.h> | 38 | #include <linux/mdio.h> |
39 | #include <linux/pm_runtime.h> | ||
39 | 40 | ||
40 | #include "e1000.h" | 41 | #include "e1000.h" |
41 | 42 | ||
@@ -2229,7 +2230,19 @@ static int e1000e_get_ts_info(struct net_device *netdev, | |||
2229 | return 0; | 2230 | return 0; |
2230 | } | 2231 | } |
2231 | 2232 | ||
2233 | static int e1000e_ethtool_begin(struct net_device *netdev) | ||
2234 | { | ||
2235 | return pm_runtime_get_sync(netdev->dev.parent); | ||
2236 | } | ||
2237 | |||
2238 | static void e1000e_ethtool_complete(struct net_device *netdev) | ||
2239 | { | ||
2240 | pm_runtime_put_sync(netdev->dev.parent); | ||
2241 | } | ||
2242 | |||
2232 | static const struct ethtool_ops e1000_ethtool_ops = { | 2243 | static const struct ethtool_ops e1000_ethtool_ops = { |
2244 | .begin = e1000e_ethtool_begin, | ||
2245 | .complete = e1000e_ethtool_complete, | ||
2233 | .get_settings = e1000_get_settings, | 2246 | .get_settings = e1000_get_settings, |
2234 | .set_settings = e1000_set_settings, | 2247 | .set_settings = e1000_set_settings, |
2235 | .get_drvinfo = e1000_get_drvinfo, | 2248 | .get_drvinfo = e1000_get_drvinfo, |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 2954cc7352e1..948b86ffa4f0 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -4663,6 +4663,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
4663 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { | 4663 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { |
4664 | int ret_val; | 4664 | int ret_val; |
4665 | 4665 | ||
4666 | pm_runtime_get_sync(&adapter->pdev->dev); | ||
4666 | ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr); | 4667 | ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr); |
4667 | ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr); | 4668 | ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr); |
4668 | ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise); | 4669 | ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise); |
@@ -4673,6 +4674,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
4673 | ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus); | 4674 | ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus); |
4674 | if (ret_val) | 4675 | if (ret_val) |
4675 | e_warn("Error reading PHY register\n"); | 4676 | e_warn("Error reading PHY register\n"); |
4677 | pm_runtime_put_sync(&adapter->pdev->dev); | ||
4676 | } else { | 4678 | } else { |
4677 | /* Do not read PHY registers if link is not up | 4679 | /* Do not read PHY registers if link is not up |
4678 | * Set values to typical power-on defaults | 4680 | * Set values to typical power-on defaults |