Commit 7dbf6acd authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

skge: Do not use legacy PCI power management

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 18c8d82a
...@@ -4042,53 +4042,40 @@ static void __devexit skge_remove(struct pci_dev *pdev) ...@@ -4042,53 +4042,40 @@ static void __devexit skge_remove(struct pci_dev *pdev)
} }
#ifdef CONFIG_PM #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); struct skge_hw *hw = pci_get_drvdata(pdev);
int i, err, wol = 0; int i;
if (!hw) if (!hw)
return 0; return 0;
err = pci_save_state(pdev);
if (err)
return err;
for (i = 0; i < hw->ports; i++) { for (i = 0; i < hw->ports; i++) {
struct net_device *dev = hw->dev[i]; struct net_device *dev = hw->dev[i];
struct skge_port *skge = netdev_priv(dev); struct skge_port *skge = netdev_priv(dev);
if (netif_running(dev)) if (netif_running(dev))
skge_down(dev); skge_down(dev);
if (skge->wol) if (skge->wol)
skge_wol_init(skge); skge_wol_init(skge);
wol |= skge->wol;
} }
skge_write32(hw, B0_IMSK, 0); skge_write32(hw, B0_IMSK, 0);
pci_prepare_to_sleep(pdev);
return 0; 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); struct skge_hw *hw = pci_get_drvdata(pdev);
int i, err; int i, err;
if (!hw) if (!hw)
return 0; 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); err = skge_reset(hw);
if (err) if (err)
goto out; goto out;
...@@ -4109,12 +4096,19 @@ static int skge_resume(struct pci_dev *pdev) ...@@ -4109,12 +4096,19 @@ static int skge_resume(struct pci_dev *pdev)
out: out:
return err; 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 #endif
static void skge_shutdown(struct pci_dev *pdev) static void skge_shutdown(struct pci_dev *pdev)
{ {
struct skge_hw *hw = pci_get_drvdata(pdev); struct skge_hw *hw = pci_get_drvdata(pdev);
int i, wol = 0; int i;
if (!hw) if (!hw)
return; return;
...@@ -4125,15 +4119,10 @@ static void skge_shutdown(struct pci_dev *pdev) ...@@ -4125,15 +4119,10 @@ static void skge_shutdown(struct pci_dev *pdev)
if (skge->wol) if (skge->wol)
skge_wol_init(skge); skge_wol_init(skge);
wol |= skge->wol;
} }
if (pci_enable_wake(pdev, PCI_D3cold, wol)) pci_wake_from_d3(pdev, device_may_wakeup(&pdev->dev));
pci_enable_wake(pdev, PCI_D3hot, wol);
pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
} }
static struct pci_driver skge_driver = { static struct pci_driver skge_driver = {
...@@ -4141,11 +4130,8 @@ static struct pci_driver skge_driver = { ...@@ -4141,11 +4130,8 @@ static struct pci_driver skge_driver = {
.id_table = skge_id_table, .id_table = skge_id_table,
.probe = skge_probe, .probe = skge_probe,
.remove = __devexit_p(skge_remove), .remove = __devexit_p(skge_remove),
#ifdef CONFIG_PM
.suspend = skge_suspend,
.resume = skge_resume,
#endif
.shutdown = skge_shutdown, .shutdown = skge_shutdown,
.driver.pm = SKGE_PM_OPS,
}; };
static struct dmi_system_id skge_32bit_dma_boards[] = { static struct dmi_system_id skge_32bit_dma_boards[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment