aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2010-12-30 03:52:29 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-31 15:50:18 -0500
commit7dbf6acdbad2fbc6eea72b58404461dcb7c6d9d2 (patch)
treed140d77e379168f41287935de5f9825a30016dae /drivers/net/skge.c
parent18c8d82ae5b802c5d82e0dfbcc08b1b568955f46 (diff)
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: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index c149e48a0f57..42daf98ba736 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -4042,53 +4042,40 @@ static void __devexit skge_remove(struct pci_dev *pdev)
4042} 4042}
4043 4043
4044#ifdef CONFIG_PM 4044#ifdef CONFIG_PM
4045static int skge_suspend(struct pci_dev *pdev, pm_message_t state) 4045static int skge_suspend(struct device *dev)
4046{ 4046{
4047 struct pci_dev *pdev = to_pci_dev(dev);
4047 struct skge_hw *hw = pci_get_drvdata(pdev); 4048 struct skge_hw *hw = pci_get_drvdata(pdev);
4048 int i, err, wol = 0; 4049 int i;
4049 4050
4050 if (!hw) 4051 if (!hw)
4051 return 0; 4052 return 0;
4052 4053
4053 err = pci_save_state(pdev);
4054 if (err)
4055 return err;
4056
4057 for (i = 0; i < hw->ports; i++) { 4054 for (i = 0; i < hw->ports; i++) {
4058 struct net_device *dev = hw->dev[i]; 4055 struct net_device *dev = hw->dev[i];
4059 struct skge_port *skge = netdev_priv(dev); 4056 struct skge_port *skge = netdev_priv(dev);
4060 4057
4061 if (netif_running(dev)) 4058 if (netif_running(dev))
4062 skge_down(dev); 4059 skge_down(dev);
4060
4063 if (skge->wol) 4061 if (skge->wol)
4064 skge_wol_init(skge); 4062 skge_wol_init(skge);
4065
4066 wol |= skge->wol;
4067 } 4063 }
4068 4064
4069 skge_write32(hw, B0_IMSK, 0); 4065 skge_write32(hw, B0_IMSK, 0);
4070 4066
4071 pci_prepare_to_sleep(pdev);
4072
4073 return 0; 4067 return 0;
4074} 4068}
4075 4069
4076static int skge_resume(struct pci_dev *pdev) 4070static int skge_resume(struct device *dev)
4077{ 4071{
4072 struct pci_dev *pdev = to_pci_dev(dev);
4078 struct skge_hw *hw = pci_get_drvdata(pdev); 4073 struct skge_hw *hw = pci_get_drvdata(pdev);
4079 int i, err; 4074 int i, err;
4080 4075
4081 if (!hw) 4076 if (!hw)
4082 return 0; 4077 return 0;
4083 4078
4084 err = pci_back_from_sleep(pdev);
4085 if (err)
4086 goto out;
4087
4088 err = pci_restore_state(pdev);
4089 if (err)
4090 goto out;
4091
4092 err = skge_reset(hw); 4079 err = skge_reset(hw);
4093 if (err) 4080 if (err)
4094 goto out; 4081 goto out;
@@ -4109,12 +4096,19 @@ static int skge_resume(struct pci_dev *pdev)
4109out: 4096out:
4110 return err; 4097 return err;
4111} 4098}
4099
4100static SIMPLE_DEV_PM_OPS(skge_pm_ops, skge_suspend, skge_resume);
4101#define SKGE_PM_OPS (&skge_pm_ops)
4102
4103#else
4104
4105#define SKGE_PM_OPS NULL
4112#endif 4106#endif
4113 4107
4114static void skge_shutdown(struct pci_dev *pdev) 4108static void skge_shutdown(struct pci_dev *pdev)
4115{ 4109{
4116 struct skge_hw *hw = pci_get_drvdata(pdev); 4110 struct skge_hw *hw = pci_get_drvdata(pdev);
4117 int i, wol = 0; 4111 int i;
4118 4112
4119 if (!hw) 4113 if (!hw)
4120 return; 4114 return;
@@ -4125,15 +4119,10 @@ static void skge_shutdown(struct pci_dev *pdev)
4125 4119
4126 if (skge->wol) 4120 if (skge->wol)
4127 skge_wol_init(skge); 4121 skge_wol_init(skge);
4128 wol |= skge->wol;
4129 } 4122 }
4130 4123
4131 if (pci_enable_wake(pdev, PCI_D3cold, wol)) 4124 pci_wake_from_d3(pdev, device_may_wakeup(&pdev->dev));
4132 pci_enable_wake(pdev, PCI_D3hot, wol);
4133
4134 pci_disable_device(pdev);
4135 pci_set_power_state(pdev, PCI_D3hot); 4125 pci_set_power_state(pdev, PCI_D3hot);
4136
4137} 4126}
4138 4127
4139static struct pci_driver skge_driver = { 4128static struct pci_driver skge_driver = {
@@ -4141,11 +4130,8 @@ static struct pci_driver skge_driver = {
4141 .id_table = skge_id_table, 4130 .id_table = skge_id_table,
4142 .probe = skge_probe, 4131 .probe = skge_probe,
4143 .remove = __devexit_p(skge_remove), 4132 .remove = __devexit_p(skge_remove),
4144#ifdef CONFIG_PM
4145 .suspend = skge_suspend,
4146 .resume = skge_resume,
4147#endif
4148 .shutdown = skge_shutdown, 4133 .shutdown = skge_shutdown,
4134 .driver.pm = SKGE_PM_OPS,
4149}; 4135};
4150 4136
4151static struct dmi_system_id skge_32bit_dma_boards[] = { 4137static struct dmi_system_id skge_32bit_dma_boards[] = {