From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: "Garzik, Jeff" <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, "Brandeburg,
Jesse" <jesse.brandeburg@intel.com>,
"Kok, Auke" <auke-jan.h.kok@intel.com>,
"Kok, Auke" <auke@foo-projects.org>,
"Ronciak, John" <john.ronciak@intel.com>
Subject: [PATCH 04/23] e100: rework WoL and shutdown handling
Date: Tue, 19 Sep 2006 10:28:40 -0700 [thread overview]
Message-ID: <20060919172840.4605.33452.stgit@gitlost.site> (raw)
In-Reply-To: <20060919172623.4605.56860.stgit@gitlost.site>
Unify our shutdown/suspend/resume code and make it similar to e1000:
e1000_shutdown now calls suspend which does the exact same thing on
shutdown except saving PCI config state on suspend. WoL setup code
is now also more simple and works even when CONFIG_PM is not set, which
was previously broken.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e100.c | 51 ++++++++++++++++++++-------------------------------
1 files changed, 20 insertions(+), 31 deletions(-)
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index ae93c62..94ca60b 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2717,68 +2717,56 @@ static void __devexit e100_remove(struct
}
}
-#ifdef CONFIG_PM
static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct nic *nic = netdev_priv(netdev);
- int retval;
- if(netif_running(netdev))
+ if (netif_running(netdev))
e100_down(nic);
e100_hw_reset(nic);
netif_device_detach(netdev);
+#ifdef CONFIG_PM
pci_save_state(pdev);
- retval = pci_enable_wake(pdev, pci_choose_state(pdev, state),
- nic->flags & (wol_magic | e100_asf(nic)));
- if (retval)
- DPRINTK(PROBE,ERR, "Error enabling wake\n");
+ if (nic->flags & (wol_magic | e100_asf(nic)))
+#else
+ if (nic->flags & (wol_magic))
+#endif
+ pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
+ else
+ /* disable PME */
+ pci_enable_wake(pdev, 0, 0);
+
pci_disable_device(pdev);
- retval = pci_set_power_state(pdev, pci_choose_state(pdev, state));
- if (retval)
- DPRINTK(PROBE,ERR, "Error %d setting power state\n", retval);
+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
+#ifdef CONFIG_PM
static int e100_resume(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct nic *nic = netdev_priv(netdev);
- int retval;
- retval = pci_set_power_state(pdev, PCI_D0);
- if (retval)
- DPRINTK(PROBE,ERR, "Error waking adapter\n");
+ pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
/* ack any pending wake events, disable PME */
- retval = pci_enable_wake(pdev, 0, 0);
- if (retval)
- DPRINTK(PROBE,ERR, "Error clearing wake events\n");
+ pci_enable_wake(pdev, 0, 0);
netif_device_attach(netdev);
- if(netif_running(netdev))
+ if (netif_running(netdev))
e100_up(nic);
return 0;
}
-#endif
+#endif /* CONFIG_PM */
static void e100_shutdown(struct pci_dev *pdev)
{
- struct net_device *netdev = pci_get_drvdata(pdev);
- struct nic *nic = netdev_priv(netdev);
- int retval;
-
-#ifdef CONFIG_PM
- retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
-#else
- retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic));
-#endif
- if (retval)
- DPRINTK(PROBE,ERR, "Error enabling wake\n");
+ e100_suspend(pdev, PMSG_SUSPEND);
}
/* ------------------ PCI Error Recovery infrastructure -------------- */
@@ -2862,8 +2850,9 @@ static struct pci_driver e100_driver = {
.id_table = e100_id_table,
.probe = e100_probe,
.remove = __devexit_p(e100_remove),
-#ifdef CONFIG_PM
+ /* Power Management hooks */
.suspend = e100_suspend,
+#ifdef CONFIG_PM
.resume = e100_resume,
#endif
.shutdown = e100_shutdown,
---
Auke Kok <auke-jan.h.kok@intel.com>
next prev parent reply other threads:[~2006-09-19 17:19 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-19 17:26 [PATCH 00/23] e100, e1000, ixgb updates Kok, Auke
2006-09-19 17:28 ` [PATCH 01/23] e100, e1000, ixgb: update copyright header and remove LICENSE Kok, Auke
2006-09-19 17:28 ` [PATCH 02/23] e100, e1000, ixgb: Fix an impossible memory overwrite bug Kok, Auke
2006-09-19 17:28 ` [PATCH 03/23] e100: Add debugging code for cb cleaning and csum failures Kok, Auke
2006-09-19 19:10 ` Jeff Garzik
2006-09-19 22:25 ` Auke Kok
2006-09-19 21:33 ` Dave Jones
2006-09-19 21:40 ` Jeff Garzik
2006-09-19 21:46 ` Dave Jones
2006-09-19 22:21 ` Auke Kok
2006-09-19 17:28 ` Kok, Auke [this message]
2006-09-19 19:10 ` [PATCH 04/23] e100: rework WoL and shutdown handling Jeff Garzik
2006-09-19 20:25 ` Auke Kok
2006-09-19 20:30 ` Jeff Garzik
2006-09-19 21:38 ` Auke Kok
2006-09-19 17:28 ` [PATCH 05/23] e1000: rename flow control symbols Kok, Auke
2006-09-19 19:11 ` Jeff Garzik
2006-09-19 21:45 ` Auke Kok
2006-09-19 17:28 ` [PATCH 06/23] e1000: add enums for several link properties Kok, Auke
2006-09-19 17:28 ` [PATCH 07/23] e1000: remove unused code and make symbols static Kok, Auke
2006-09-19 19:28 ` Jeff Garzik
2006-09-19 17:28 ` [PATCH 08/23] e1000: add multicast stats counters Kok, Auke
2006-09-19 19:28 ` Jeff Garzik
2006-09-19 17:28 ` [PATCH 09/23] e1000: allow ethtool to pass arbitrary speed advertisment Kok, Auke
2006-09-19 17:28 ` [PATCH 10/23] e1000: Fix MANC detection for PCIE adapters Kok, Auke
2006-09-19 19:31 ` Jeff Garzik
2006-09-19 17:28 ` [PATCH 11/23] e1000: Jumbo frames fixes for 82573 Kok, Auke
2006-09-19 19:32 ` Jeff Garzik
2006-09-20 15:37 ` Auke Kok
2006-09-19 17:28 ` [PATCH 12/23] e1000: Maybe stop TX if not enough free descriptors Kok, Auke
2006-09-19 19:37 ` Jeff Garzik
2006-09-19 19:38 ` Jeff Garzik
2006-09-19 19:50 ` Stephen Hemminger
2006-09-19 20:45 ` Jeff Garzik
2006-09-19 20:59 ` Stephen Hemminger
2006-09-19 23:26 ` Auke Kok
2006-09-19 23:59 ` Stephen Hemminger
2006-09-20 15:30 ` Auke Kok
[not found] ` <4807377b0609211659mb0cb308hcbc78520148300a1@mail.gmail.com>
2006-09-24 11:30 ` Fwd: " Herbert Xu
2006-09-19 17:29 ` [PATCH 13/23] e1000: gather hardware bit tweaks Kok, Auke
2006-09-19 19:36 ` Jeff Garzik
2006-09-27 20:12 ` Auke Kok
2006-09-19 17:29 ` [PATCH 14/23] e1000: handle manageability for pci-e adapters at PHY powerdown Kok, Auke
2006-09-19 19:39 ` Jeff Garzik
2006-09-19 17:29 ` [PATCH 15/23] e1000: add PCI-E capability detection code Kok, Auke
2006-09-19 17:29 ` [PATCH 16/23] e1000: reduce RAR entries available for ICH8 Kok, Auke
2006-09-19 19:39 ` Jeff Garzik
2006-09-19 17:29 ` [PATCH 17/23] e1000: driver state fixes (race fix) Kok, Auke
2006-09-19 19:40 ` Jeff Garzik
2006-09-19 17:29 ` [PATCH 18/23] e1000: revert 'e1000: Remove 0x1000 as supported device' Kok, Auke
2006-09-19 19:40 ` Jeff Garzik
2006-09-19 20:34 ` Auke Kok
2006-09-19 20:43 ` Jeff Garzik
2006-09-19 17:29 ` [PATCH 19/23] e1000: rework polarity, NVM, eeprom code and fixes Kok, Auke
2006-09-19 17:29 ` [PATCH 20/23] e1000: don't strip vlan ID if 8021q claims it Kok, Auke
2006-09-19 19:41 ` Jeff Garzik
2006-09-19 17:29 ` [PATCH 21/23] ixgb: combine more rx descriptors to improve performance Kok, Auke
2006-09-19 17:29 ` [PATCH 22/23] ixgb: convert to netdev_priv(netdev) Kok, Auke
2006-09-19 17:29 ` [PATCH 23/23] e100, e1000, ixgb: increment version numbers Kok, Auke
2006-09-19 19:41 ` Jeff Garzik
2006-09-19 19:42 ` [PATCH 00/23] e100, e1000, ixgb updates Jeff Garzik
2006-09-19 21:06 ` Auke Kok
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060919172840.4605.33452.stgit@gitlost.site \
--to=auke-jan.h.kok@intel.com \
--cc=auke@foo-projects.org \
--cc=jesse.brandeburg@intel.com \
--cc=jgarzik@pobox.com \
--cc=john.ronciak@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).