From: Stephen Hemminger <shemminger@vyatta.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
"Linux-pm mailing list" <linux-pm@lists.linux-foundation.org>
Subject: [PATCH] skge: Do not use legacy PCI power management
Date: Thu, 30 Dec 2010 10:52:29 -0800 [thread overview]
Message-ID: <20101230105229.189f3737@nehalam> (raw)
In-Reply-To: <201012261944.32517.rjw@sisk.pl>
The skge driver used the legacy PCI power management, and did its
own PCI callbacks. Use the same code model as Rafael's changes to
sky2. Let the PCI subsystem take care of all the PCI-specific aspects of
device handling during system power transitions.
Compile tested only (so far).
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/skge.c 2010-12-30 10:19:01.191095951 -0800
+++ b/drivers/net/skge.c 2010-12-30 10:49:30.780295215 -0800
@@ -4044,53 +4044,40 @@ static void __devexit skge_remove(struct
}
#ifdef CONFIG_PM
-static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
+static int skge_suspend(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct skge_hw *hw = pci_get_drvdata(pdev);
- int i, err, wol = 0;
+ int i;
if (!hw)
return 0;
- err = pci_save_state(pdev);
- if (err)
- return err;
-
for (i = 0; i < hw->ports; i++) {
struct net_device *dev = hw->dev[i];
struct skge_port *skge = netdev_priv(dev);
if (netif_running(dev))
skge_down(dev);
+
if (skge->wol)
skge_wol_init(skge);
-
- wol |= skge->wol;
}
skge_write32(hw, B0_IMSK, 0);
- pci_prepare_to_sleep(pdev);
-
return 0;
}
-static int skge_resume(struct pci_dev *pdev)
+static int skge_resume(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct skge_hw *hw = pci_get_drvdata(pdev);
int i, err;
if (!hw)
return 0;
- err = pci_back_from_sleep(pdev);
- if (err)
- goto out;
-
- err = pci_restore_state(pdev);
- if (err)
- goto out;
-
err = skge_reset(hw);
if (err)
goto out;
@@ -4111,12 +4098,19 @@ static int skge_resume(struct pci_dev *p
out:
return err;
}
+
+static SIMPLE_DEV_PM_OPS(skge_pm_ops, skge_suspend, skge_resume);
+#define SKGE_PM_OPS (&skge_pm_ops)
+
+#else
+
+#define SKGE_PM_OPS NULL
#endif
static void skge_shutdown(struct pci_dev *pdev)
{
struct skge_hw *hw = pci_get_drvdata(pdev);
- int i, wol = 0;
+ int i;
if (!hw)
return;
@@ -4127,15 +4121,10 @@ static void skge_shutdown(struct pci_dev
if (skge->wol)
skge_wol_init(skge);
- wol |= skge->wol;
}
- if (pci_enable_wake(pdev, PCI_D3cold, wol))
- pci_enable_wake(pdev, PCI_D3hot, wol);
-
- pci_disable_device(pdev);
+ pci_wake_from_d3(pdev, device_may_wakeup(&pdev->dev));
pci_set_power_state(pdev, PCI_D3hot);
-
}
static struct pci_driver skge_driver = {
@@ -4143,11 +4132,8 @@ static struct pci_driver skge_driver = {
.id_table = skge_id_table,
.probe = skge_probe,
.remove = __devexit_p(skge_remove),
-#ifdef CONFIG_PM
- .suspend = skge_suspend,
- .resume = skge_resume,
-#endif
.shutdown = skge_shutdown,
+ .driver.pm = SKGE_PM_OPS,
};
static struct dmi_system_id skge_32bit_dma_boards[] = {
next prev parent reply other threads:[~2010-12-30 18:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-26 18:44 [PATCH] sky2: Do not use legacy PCI power management Rafael J. Wysocki
2010-12-30 18:52 ` Stephen Hemminger [this message]
2010-12-30 22:50 ` [PATCH] skge: " Rafael J. Wysocki
2010-12-31 20:50 ` David Miller
2010-12-31 20:50 ` David Miller
2010-12-30 22:50 ` Rafael J. Wysocki
2010-12-30 18:52 ` Stephen Hemminger
2010-12-31 18:15 ` [PATCH] sky2: " Stephen Hemminger
2010-12-31 19:14 ` David Miller
2010-12-31 18:15 ` Stephen Hemminger
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=20101230105229.189f3737@nehalam \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=linux-pm@lists.linux-foundation.org \
--cc=netdev@vger.kernel.org \
--cc=rjw@sisk.pl \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.