Commit e60b22c5 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Jeff Kirsher

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: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: default avatarBorislav Petkov <bp@suse.de>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 66148bab
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/mdio.h> #include <linux/mdio.h>
#include <linux/pm_runtime.h>
#include "e1000.h" #include "e1000.h"
...@@ -2229,7 +2230,19 @@ static int e1000e_get_ts_info(struct net_device *netdev, ...@@ -2229,7 +2230,19 @@ static int e1000e_get_ts_info(struct net_device *netdev,
return 0; return 0;
} }
static int e1000e_ethtool_begin(struct net_device *netdev)
{
return pm_runtime_get_sync(netdev->dev.parent);
}
static void e1000e_ethtool_complete(struct net_device *netdev)
{
pm_runtime_put_sync(netdev->dev.parent);
}
static const struct ethtool_ops e1000_ethtool_ops = { static const struct ethtool_ops e1000_ethtool_ops = {
.begin = e1000e_ethtool_begin,
.complete = e1000e_ethtool_complete,
.get_settings = e1000_get_settings, .get_settings = e1000_get_settings,
.set_settings = e1000_set_settings, .set_settings = e1000_set_settings,
.get_drvinfo = e1000_get_drvinfo, .get_drvinfo = e1000_get_drvinfo,
......
...@@ -4663,6 +4663,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) ...@@ -4663,6 +4663,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
(adapter->hw.phy.media_type == e1000_media_type_copper)) { (adapter->hw.phy.media_type == e1000_media_type_copper)) {
int ret_val; int ret_val;
pm_runtime_get_sync(&adapter->pdev->dev);
ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr); ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr);
ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr); ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr);
ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise); ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise);
...@@ -4673,6 +4674,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) ...@@ -4673,6 +4674,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus); ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus);
if (ret_val) if (ret_val)
e_warn("Error reading PHY register\n"); e_warn("Error reading PHY register\n");
pm_runtime_put_sync(&adapter->pdev->dev);
} else { } else {
/* Do not read PHY registers if link is not up /* Do not read PHY registers if link is not up
* Set values to typical power-on defaults * Set values to typical power-on defaults
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment