From patchwork Tue Nov 4 16:44:20 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: 7137 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 73A70DDE0E for ; Wed, 5 Nov 2008 03:41:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752694AbYKDQlh (ORCPT ); Tue, 4 Nov 2008 11:41:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752248AbYKDQlf (ORCPT ); Tue, 4 Nov 2008 11:41:35 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:47764 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752058AbYKDQlc (ORCPT ); Tue, 4 Nov 2008 11:41:32 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 4665910DCF8; Tue, 4 Nov 2008 15:47:14 +0100 (CET) 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 27340-01; Tue, 4 Nov 2008 15:47:03 +0100 (CET) Received: from [192.168.2.14] (iftwlan1.fuw.edu.pl [193.0.83.199]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 3AAE010DD62; Tue, 4 Nov 2008 15:47:03 +0100 (CET) From: "Rafael J. Wysocki" To: "Brandeburg, Jesse" Subject: [PATCH 3/3] igb: Use device_set_wakeup_enable Date: Tue, 4 Nov 2008 17:44:20 +0100 User-Agent: KMail/1.9.9 Cc: David Miller , "jeff@garzik.org" , Andrew Morton , "netdev@vger.kernel.org" , "e1000-devel@lists.sourceforge.net" , "bugme-daemon@bugzilla.kernel.org" , "rogerx@sdf.lonestar.org" References: <200811040243.33386.rjw@sisk.pl> <200811041740.50426.rjw@sisk.pl> In-Reply-To: <200811041740.50426.rjw@sisk.pl> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200811041744.21236.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 Author: Rafael J. Wysocki Subject: igb: Use device_set_wakeup_enable 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 igb_set_wol(). Accordingly, use device_can_wakeup() for checking if wake-up is supported by the device. Signed-off-by: Rafael J. Wysocki --- drivers/net/igb/igb_ethtool.c | 8 ++++++-- drivers/net/igb/igb_main.c | 1 + 2 files changed, 7 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/igb/igb_ethtool.c =================================================================== --- linux-2.6.orig/drivers/net/igb/igb_ethtool.c +++ linux-2.6/drivers/net/igb/igb_ethtool.c @@ -1776,7 +1776,8 @@ static void igb_get_wol(struct net_devic /* this function will set ->supported = 0 and return 1 if wol is not * supported by this hardware */ - if (igb_wol_exclusion(adapter, wol)) + if (igb_wol_exclusion(adapter, wol) || + !device_can_wakeup(&adapter->pdev->dev)) return; /* apply any specific unsupported masks here */ @@ -1805,7 +1806,8 @@ static int igb_set_wol(struct net_device if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) return -EOPNOTSUPP; - if (igb_wol_exclusion(adapter, wol)) + if (igb_wol_exclusion(adapter, wol) || + !device_can_wakeup(&adapter->pdev->dev)) return wol->wolopts ? -EOPNOTSUPP : 0; switch (hw->device_id) { @@ -1825,6 +1827,8 @@ static int igb_set_wol(struct net_device if (wol->wolopts & WAKE_MAGIC) adapter->wol |= E1000_WUFC_MAG; + device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); + return 0; } Index: linux-2.6/drivers/net/igb/igb_main.c =================================================================== --- linux-2.6.orig/drivers/net/igb/igb_main.c +++ linux-2.6/drivers/net/igb/igb_main.c @@ -1244,6 +1244,7 @@ static int __devinit igb_probe(struct pc /* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; + device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); /* reset the hardware with the new settings */ igb_reset(adapter);