diff options
author | Konstantin Khlebnikov | 2013-05-08 03:10:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-05-11 15:53:53 -0500 |
commit | b241f9dc4c1f736711d8ea471de604a97807454f (patch) | |
tree | bc3096cab096662721ce9ee68acd17ea047c4fe3 | |
parent | f38a22c6fde1ae94fbc3fd2f382f03a1e0d617eb (diff) | |
download | kernel-omap-b241f9dc4c1f736711d8ea471de604a97807454f.tar.gz kernel-omap-b241f9dc4c1f736711d8ea471de604a97807454f.tar.xz kernel-omap-b241f9dc4c1f736711d8ea471de604a97807454f.zip |
e1000e: fix accessing to suspended device
commit e60b22c5b7e59db09a7c9490b1e132c7e49ae904 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>
-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 fd4772a2691c..522fb102e2b1 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/vmalloc.h> | 37 | #include <linux/vmalloc.h> |
38 | #include <linux/pm_runtime.h> | ||
38 | 39 | ||
39 | #include "e1000.h" | 40 | #include "e1000.h" |
40 | 41 | ||
@@ -2053,7 +2054,19 @@ static int e1000_get_rxnfc(struct net_device *netdev, | |||
2053 | } | 2054 | } |
2054 | } | 2055 | } |
2055 | 2056 | ||
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 | |||
2056 | static const struct ethtool_ops e1000_ethtool_ops = { | 2067 | static const struct ethtool_ops e1000_ethtool_ops = { |
2068 | .begin = e1000e_ethtool_begin, | ||
2069 | .complete = e1000e_ethtool_complete, | ||
2057 | .get_settings = e1000_get_settings, | 2070 | .get_settings = e1000_get_settings, |
2058 | .set_settings = e1000_set_settings, | 2071 | .set_settings = e1000_set_settings, |
2059 | .get_drvinfo = e1000_get_drvinfo, | 2072 | .get_drvinfo = e1000_get_drvinfo, |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 4570cad05057..8692ecac536f 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -4313,6 +4313,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
4313 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { | 4313 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { |
4314 | int ret_val; | 4314 | int ret_val; |
4315 | 4315 | ||
4316 | pm_runtime_get_sync(&adapter->pdev->dev); | ||
4316 | ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); | 4317 | ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); |
4317 | ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); | 4318 | ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); |
4318 | ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); | 4319 | ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); |
@@ -4323,6 +4324,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
4323 | ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus); | 4324 | ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus); |
4324 | if (ret_val) | 4325 | if (ret_val) |
4325 | e_warn("Error reading PHY register\n"); | 4326 | e_warn("Error reading PHY register\n"); |
4327 | pm_runtime_put_sync(&adapter->pdev->dev); | ||
4326 | } else { | 4328 | } else { |
4327 | /* Do not read PHY registers if link is not up | 4329 | /* Do not read PHY registers if link is not up |
4328 | * Set values to typical power-on defaults | 4330 | * Set values to typical power-on defaults |