From patchwork Mon Sep 22 21:10:15 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 940 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 17A2DDDF0A for ; Tue, 23 Sep 2008 07:11:43 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753501AbYIVVLb (ORCPT ); Mon, 22 Sep 2008 17:11:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753382AbYIVVLb (ORCPT ); Mon, 22 Sep 2008 17:11:31 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:40055 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753192AbYIVVLa (ORCPT ); Mon, 22 Sep 2008 17:11:30 -0400 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id m8MLAGwE014562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Sep 2008 14:10:17 -0700 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id m8MLAFYm029864; Mon, 22 Sep 2008 14:10:15 -0700 Message-Id: <200809222110.m8MLAFYm029864@imap1.linux-foundation.org> Subject: [patch for 2.6.27? 01/10] e100: adapt to the reworked PCI PM To: jeff@garzik.org Cc: netdev@vger.kernel.org, akpm@linux-foundation.org, rjw@sisk.pl, elendil@planet.nl, jbarnes@virtuousgeek.org, jeffrey.t.kirsher@intel.com From: akpm@linux-foundation.org Date: Mon, 22 Sep 2008 14:10:15 -0700 X-Spam-Status: No, hits=-3.358 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: "Rafael J. Wysocki" Adapt the e100 driver to the reworked PCI PM * Use device_set_wakeup_enable() and friends as needed * Use pci_pme_active() to clear PME_Status and disable PME# * Use the observation that it is sufficient to call pci_enable_wake() once, unless it fails Signed-off-by: Rafael J. Wysocki Tested-by: Jeff Kirsher Acked-by: Jeff Kirsher Cc: Jesse Barnes Cc: Jeff Garzik Cc: Frans Pop Signed-off-by: Andrew Morton --- drivers/net/e100.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff -puN drivers/net/e100.c~e100-adapt-to-the-reworked-pci-pm drivers/net/e100.c --- a/drivers/net/e100.c~e100-adapt-to-the-reworked-pci-pm +++ a/drivers/net/e100.c @@ -2211,7 +2211,8 @@ static int e100_set_wol(struct net_devic { struct nic *nic = netdev_priv(netdev); - if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) + if ((wol->wolopts && wol->wolopts != WAKE_MAGIC) || + !device_can_wakeup(&nic->pdev->dev)) return -EOPNOTSUPP; if(wol->wolopts) @@ -2219,6 +2220,8 @@ static int e100_set_wol(struct net_devic else nic->flags &= ~wol_magic; + device_set_wakeup_enable(&nic->pdev->dev, wol->wolopts); + e100_exec_cb(nic, NULL, e100_configure); return 0; @@ -2623,8 +2626,10 @@ static int __devinit e100_probe(struct p /* Wol magic packet can be enabled from eeprom */ if((nic->mac >= mac_82558_D101_A4) && - (nic->eeprom[eeprom_id] & eeprom_id_wol)) + (nic->eeprom[eeprom_id] & eeprom_id_wol)) { nic->flags |= wol_magic; + device_set_wakeup_enable(&pdev->dev, true); + } /* ack any pending wake events, disable PME */ pci_pme_active(pdev, false); @@ -2683,11 +2688,10 @@ static int e100_suspend(struct pci_dev * pci_save_state(pdev); if ((nic->flags & wol_magic) | e100_asf(nic)) { - pci_enable_wake(pdev, PCI_D3hot, 1); - pci_enable_wake(pdev, PCI_D3cold, 1); + if (pci_enable_wake(pdev, PCI_D3cold, true)) + pci_enable_wake(pdev, PCI_D3hot, true); } else { - pci_enable_wake(pdev, PCI_D3hot, 0); - pci_enable_wake(pdev, PCI_D3cold, 0); + pci_enable_wake(pdev, PCI_D3hot, false); } pci_disable_device(pdev);