Skip to content

Commit b241f9d

Browse files
koct9igregkh
authored andcommitted
e1000e: fix accessing to suspended device
commit e60b22c upstream. This patch fixes some annoying messages like 'Error reading PHY register' and 'Hardware Erorr' and saves several seconds on reboot. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Bruce Allan <bruce.w.allan@intel.com> 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> Tested-by: Tóth Attila <atoth@atoth.sote.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f38a22c commit b241f9d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

drivers/net/ethernet/intel/e1000e/ethtool.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <linux/slab.h>
3636
#include <linux/delay.h>
3737
#include <linux/vmalloc.h>
38+
#include <linux/pm_runtime.h>
3839

3940
#include "e1000.h"
4041

@@ -2053,7 +2054,19 @@ static int e1000_get_rxnfc(struct net_device *netdev,
20532054
}
20542055
}
20552056

2057+
static int e1000e_ethtool_begin(struct net_device *netdev)
2058+
{
2059+
return pm_runtime_get_sync(netdev->dev.parent);
2060+
}
2061+
2062+
static void e1000e_ethtool_complete(struct net_device *netdev)
2063+
{
2064+
pm_runtime_put_sync(netdev->dev.parent);
2065+
}
2066+
20562067
static const struct ethtool_ops e1000_ethtool_ops = {
2068+
.begin = e1000e_ethtool_begin,
2069+
.complete = e1000e_ethtool_complete,
20572070
.get_settings = e1000_get_settings,
20582071
.set_settings = e1000_set_settings,
20592072
.get_drvinfo = e1000_get_drvinfo,

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4313,6 +4313,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
43134313
(adapter->hw.phy.media_type == e1000_media_type_copper)) {
43144314
int ret_val;
43154315

4316+
pm_runtime_get_sync(&adapter->pdev->dev);
43164317
ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr);
43174318
ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr);
43184319
ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise);
@@ -4323,6 +4324,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
43234324
ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus);
43244325
if (ret_val)
43254326
e_warn("Error reading PHY register\n");
4327+
pm_runtime_put_sync(&adapter->pdev->dev);
43264328
} else {
43274329
/* Do not read PHY registers if link is not up
43284330
* Set values to typical power-on defaults

0 commit comments

Comments
 (0)