From patchwork Thu Oct 2 21:39:33 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 2475 X-Patchwork-Delegate: jgarzik@pobox.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id BFD50DDFC9 for ; Fri, 3 Oct 2008 07:35:37 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754455AbYJBVfc (ORCPT ); Thu, 2 Oct 2008 17:35:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754423AbYJBVfc (ORCPT ); Thu, 2 Oct 2008 17:35:32 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:36362 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754300AbYJBVfa (ORCPT ); Thu, 2 Oct 2008 17:35:30 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 80799101991; Thu, 2 Oct 2008 21:51:40 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20845-05; Thu, 2 Oct 2008 21:51:33 +0200 (CEST) Received: from [192.168.100.100] (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 8C06910194B; Thu, 2 Oct 2008 21:51:33 +0200 (CEST) From: "Rafael J. Wysocki" To: Jeff Garzik Subject: [PATCH] sky2: Fix recent WOL regression Date: Thu, 2 Oct 2008 23:39:33 +0200 User-Agent: KMail/1.9.9 Cc: Andrew Morton , David Miller , LKML , pm list , Tino Keitel , Stephen Hemminger , netdev@vger.kernel.org, Jesse Barnes MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200810022339.34025.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Rafael J. Wysocki sky2: Fix recent WOL regression Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine). Remove an open-coded reference to the standard PCI PM registers that is not used any more. Signed-off-by: Rafael J. Wysocki Reported-by: Tino Keitel Acked-by: Stephen Hemminger --- drivers/net/sky2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/net/sky2.c =================================================================== --- linux-2.6.orig/drivers/net/sky2.c +++ linux-2.6/drivers/net/sky2.c @@ -3034,7 +3034,8 @@ static int sky2_set_wol(struct net_devic struct sky2_port *sky2 = netdev_priv(dev); struct sky2_hw *hw = sky2->hw; - if (wol->wolopts & ~sky2_wol_supported(sky2->hw)) + if ((wol->wolopts & ~sky2_wol_supported(sky2->hw)) + || !device_can_wakeup(&hw->pdev->dev)) return -EOPNOTSUPP; sky2->wol = wol->wolopts; @@ -3045,6 +3046,8 @@ static int sky2_set_wol(struct net_devic sky2_write32(hw, B0_CTST, sky2->wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); + device_set_wakeup_enable(&hw->pdev->dev, sky2->wol); + if (!netif_running(dev)) sky2_wol_init(sky2); return 0; @@ -4166,18 +4169,6 @@ static int __devinit sky2_test_msi(struc return err; } -static int __devinit pci_wake_enabled(struct pci_dev *dev) -{ - int pm = pci_find_capability(dev, PCI_CAP_ID_PM); - u16 value; - - if (!pm) - return 0; - if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value)) - return 0; - return value & PCI_PM_CTRL_PME_ENABLE; -} - /* This driver supports yukon2 chipset only */ static const char *sky2_name(u8 chipid, char *buf, int sz) { @@ -4238,7 +4241,7 @@ static int __devinit sky2_probe(struct p } } - wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0; + wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0; err = -ENOMEM; hw = kzalloc(sizeof(*hw), GFP_KERNEL);