From patchwork Mon Feb 4 11:56:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 2091251 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F2A12DFE82 for ; Mon, 4 Feb 2013 12:13:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754168Ab3BDMNB (ORCPT ); Mon, 4 Feb 2013 07:13:01 -0500 Received: from mail-la0-f41.google.com ([209.85.215.41]:35921 "EHLO mail-la0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754734Ab3BDL4U (ORCPT ); Mon, 4 Feb 2013 06:56:20 -0500 Received: by mail-la0-f41.google.com with SMTP id fo12so4537847lab.0 for ; Mon, 04 Feb 2013 03:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=GunQ/yt1qa41ZuJB49GZ4U/khfJVvvUq5okxxod4i3c=; b=cjEcfvRM5PmDc3/nFN/EviDnxPeOWVoxT5XO7NKuN50hAzDIWHSDz6Tyxn4wc0gFis 12lBZXv4zq+z/7UO6y4aO4mqc8GK/DQCR1lm2GDznRjner5huHEltphpTQ8YbIKRItvY M2y+0tvO3uYcMfrldMMOwlOgmCmjDXOhbkDKbUqCZBM7XsA4Yv9tqMAWdQIwCHPyvHiG uY37+BCLYI9V2zMN7yR7d2TKHrv5IIweadGYWquTV9k4dNwNZpFHmdHxwUZGFyBdKFJA IchdHx8+ZmOqc4cqImoOPduXWPEHvJOnu1as9g2ymGy7Kbl9pj0Cpg9I4fJ8gZAsLN3d NZpA== X-Received: by 10.152.144.202 with SMTP id so10mr19209401lab.9.1359978978237; Mon, 04 Feb 2013 03:56:18 -0800 (PST) Received: from localhost (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id q4sm5399102lbj.15.2013.02.04.03.56.16 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 04 Feb 2013 03:56:17 -0800 (PST) Subject: [PATCH v2 7/7] e1000e: fix accessing to suspended device To: e1000-devel@lists.sourceforge.net, linux-pci@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org From: Konstantin Khlebnikov Cc: Bruce Allan , Jeff Kirsher Date: Mon, 04 Feb 2013 15:56:15 +0400 Message-ID: <20130204115615.5569.77011.stgit@zurg> In-Reply-To: <20130204115246.5569.85829.stgit@zurg> References: <20130204115246.5569.85829.stgit@zurg> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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 Cc: Rafael J. Wysocki Cc: e1000-devel@lists.sourceforge.net Cc: Jeff Kirsher Cc: Bruce Allan --- drivers/net/ethernet/intel/e1000e/ethtool.c | 13 +++++++++++++ drivers/net/ethernet/intel/e1000e/netdev.c | 2 ++ 2 files changed, 15 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index f95bc6e..90afe58 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "e1000.h" @@ -2051,7 +2052,19 @@ static int e1000_get_rxnfc(struct net_device *netdev, } } +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 = { + .begin = e1000e_ethtool_begin, + .complete = e1000e_ethtool_complete, .get_settings = e1000_get_settings, .set_settings = e1000_set_settings, .get_drvinfo = e1000_get_drvinfo, diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 708d609..e501298 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -4267,6 +4267,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) (adapter->hw.phy.media_type == e1000_media_type_copper)) { int ret_val; + pm_runtime_get_sync(&adapter->pdev->dev); ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); @@ -4277,6 +4278,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus); if (ret_val) e_warn("Error reading PHY register\n"); + pm_runtime_put_sync(&adapter->pdev->dev); } else { /* Do not read PHY registers if link is not up * Set values to typical power-on defaults