From patchwork Tue Nov 4 16:42:34 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: 7136 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 43B65DDE08 for ; Wed, 5 Nov 2008 03:41:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751576AbYKDQlf (ORCPT ); Tue, 4 Nov 2008 11:41:35 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752135AbYKDQle (ORCPT ); Tue, 4 Nov 2008 11:41:34 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:47762 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751576AbYKDQlc (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 1809510DD62; Tue, 4 Nov 2008 15:47:15 +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 27308-02; 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 DB52E10D55F; Tue, 4 Nov 2008 15:47:02 +0100 (CET) From: "Rafael J. Wysocki" To: "Brandeburg, Jesse" Subject: [PATCH 1/3] e1000e: Use device_set_wakeup_enable Date: Tue, 4 Nov 2008 17:42:34 +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: <200811041742.35269.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: e1000e: 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 e1000_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/e1000e/ethtool.c | 8 ++++++-- drivers/net/e1000e/netdev.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/e1000e/ethtool.c =================================================================== --- linux-2.6.orig/drivers/net/e1000e/ethtool.c +++ linux-2.6/drivers/net/e1000e/ethtool.c @@ -1713,7 +1713,8 @@ static void e1000_get_wol(struct net_dev wol->supported = 0; wol->wolopts = 0; - if (!(adapter->flags & FLAG_HAS_WOL)) + if (!(adapter->flags & FLAG_HAS_WOL) || + !device_can_wakeup(&adapter->pdev->dev)) return; wol->supported = WAKE_UCAST | WAKE_MCAST | @@ -1751,7 +1752,8 @@ static int e1000_set_wol(struct net_devi if (wol->wolopts & WAKE_MAGICSECURE) return -EOPNOTSUPP; - if (!(adapter->flags & FLAG_HAS_WOL)) + if (!(adapter->flags & FLAG_HAS_WOL) || + !device_can_wakeup(&adapter->pdev->dev)) return wol->wolopts ? -EOPNOTSUPP : 0; /* these settings will always override what we currently have */ @@ -1770,6 +1772,8 @@ static int e1000_set_wol(struct net_devi if (wol->wolopts & WAKE_ARP) adapter->wol |= E1000_WUFC_ARP; + device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); + return 0; } Index: linux-2.6/drivers/net/e1000e/netdev.c =================================================================== --- linux-2.6.orig/drivers/net/e1000e/netdev.c +++ linux-2.6/drivers/net/e1000e/netdev.c @@ -4970,6 +4970,7 @@ static int __devinit e1000_probe(struct /* 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 */ e1000e_reset(adapter);