via-rhine: rework suspend and resume.
Cover of 861ab44059
.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
This commit is contained in:
parent
fc3e0f8aec
commit
e92b9b3b09
1 changed files with 20 additions and 21 deletions
|
@ -2291,17 +2291,18 @@ static void rhine_shutdown (struct pci_dev *pdev)
|
||||||
|
|
||||||
spin_unlock(&rp->lock);
|
spin_unlock(&rp->lock);
|
||||||
|
|
||||||
/* Hit power state D3 (sleep) */
|
if (system_state == SYSTEM_POWER_OFF && !avoid_D3) {
|
||||||
if (!avoid_D3)
|
|
||||||
iowrite8(ioread8(ioaddr + StickyHW) | 0x03, ioaddr + StickyHW);
|
iowrite8(ioread8(ioaddr + StickyHW) | 0x03, ioaddr + StickyHW);
|
||||||
|
|
||||||
/* TODO: Check use of pci_enable_wake() */
|
pci_wake_from_d3(pdev, true);
|
||||||
|
pci_set_power_state(pdev, PCI_D3hot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
|
static int rhine_suspend(struct device *device)
|
||||||
{
|
{
|
||||||
|
struct pci_dev *pdev = to_pci_dev(device);
|
||||||
struct net_device *dev = pci_get_drvdata(pdev);
|
struct net_device *dev = pci_get_drvdata(pdev);
|
||||||
struct rhine_private *rp = netdev_priv(dev);
|
struct rhine_private *rp = netdev_priv(dev);
|
||||||
|
|
||||||
|
@ -2313,28 +2314,21 @@ static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||||
napi_disable(&rp->napi);
|
napi_disable(&rp->napi);
|
||||||
|
|
||||||
netif_device_detach(dev);
|
netif_device_detach(dev);
|
||||||
pci_save_state(pdev);
|
|
||||||
|
|
||||||
rhine_shutdown(pdev);
|
rhine_shutdown(pdev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rhine_resume(struct pci_dev *pdev)
|
static int rhine_resume(struct device *device)
|
||||||
{
|
{
|
||||||
|
struct pci_dev *pdev = to_pci_dev(device);
|
||||||
struct net_device *dev = pci_get_drvdata(pdev);
|
struct net_device *dev = pci_get_drvdata(pdev);
|
||||||
struct rhine_private *rp = netdev_priv(dev);
|
struct rhine_private *rp = netdev_priv(dev);
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!netif_running(dev))
|
if (!netif_running(dev))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ret = pci_set_power_state(pdev, PCI_D0);
|
|
||||||
netif_info(rp, drv, dev, "Entering power state D0 %s (%d)\n",
|
|
||||||
ret ? "failed" : "succeeded", ret);
|
|
||||||
|
|
||||||
pci_restore_state(pdev);
|
|
||||||
|
|
||||||
#ifdef USE_MMIO
|
#ifdef USE_MMIO
|
||||||
enable_mmio(rp->pioaddr, rp->quirks);
|
enable_mmio(rp->pioaddr, rp->quirks);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2352,18 +2346,23 @@ static int rhine_resume(struct pci_dev *pdev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PM */
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(rhine_pm_ops, rhine_suspend, rhine_resume);
|
||||||
|
#define RHINE_PM_OPS (&rhine_pm_ops)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define RHINE_PM_OPS NULL
|
||||||
|
|
||||||
|
#endif /* !CONFIG_PM_SLEEP */
|
||||||
|
|
||||||
static struct pci_driver rhine_driver = {
|
static struct pci_driver rhine_driver = {
|
||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.id_table = rhine_pci_tbl,
|
.id_table = rhine_pci_tbl,
|
||||||
.probe = rhine_init_one,
|
.probe = rhine_init_one,
|
||||||
.remove = __devexit_p(rhine_remove_one),
|
.remove = __devexit_p(rhine_remove_one),
|
||||||
#ifdef CONFIG_PM
|
|
||||||
.suspend = rhine_suspend,
|
|
||||||
.resume = rhine_resume,
|
|
||||||
#endif /* CONFIG_PM */
|
|
||||||
.shutdown = rhine_shutdown,
|
.shutdown = rhine_shutdown,
|
||||||
|
.driver.pm = RHINE_PM_OPS,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct dmi_system_id __initdata rhine_dmi_table[] = {
|
static struct dmi_system_id __initdata rhine_dmi_table[] = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue