aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2014-11-05 05:27:27 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-06 14:38:57 -0500
commit3be3d81b629d5345664dbb07efeb5160e8f0b19f (patch)
tree5c8898367018e4f386c004caee441d47e47057b2 /drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
parent295f9d0bc3975e9885c73bfd82cdff9b739d2001 (diff)
stmmac: pci: convert to use dev_pm_ops
Convert system PM callbacks to use dev_pm_ops. In addition remove the PCI calls related to a power state since the bus code cares about this already. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index e45794de5db9..f19ac8e445ff 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -150,30 +150,26 @@ static void stmmac_pci_remove(struct pci_dev *pdev)
150 pci_disable_device(pdev); 150 pci_disable_device(pdev);
151} 151}
152 152
153#ifdef CONFIG_PM 153#ifdef CONFIG_PM_SLEEP
154static int stmmac_pci_suspend(struct pci_dev *pdev, pm_message_t state) 154static int stmmac_pci_suspend(struct device *dev)
155{ 155{
156 struct pci_dev *pdev = to_pci_dev(dev);
156 struct net_device *ndev = pci_get_drvdata(pdev); 157 struct net_device *ndev = pci_get_drvdata(pdev);
157 int ret;
158 158
159 ret = stmmac_suspend(ndev); 159 return stmmac_suspend(ndev);
160 pci_save_state(pdev);
161 pci_set_power_state(pdev, pci_choose_state(pdev, state));
162
163 return ret;
164} 160}
165 161
166static int stmmac_pci_resume(struct pci_dev *pdev) 162static int stmmac_pci_resume(struct device *dev)
167{ 163{
164 struct pci_dev *pdev = to_pci_dev(dev);
168 struct net_device *ndev = pci_get_drvdata(pdev); 165 struct net_device *ndev = pci_get_drvdata(pdev);
169 166
170 pci_set_power_state(pdev, PCI_D0);
171 pci_restore_state(pdev);
172
173 return stmmac_resume(ndev); 167 return stmmac_resume(ndev);
174} 168}
175#endif 169#endif
176 170
171static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume);
172
177#define STMMAC_VENDOR_ID 0x700 173#define STMMAC_VENDOR_ID 0x700
178#define STMMAC_DEVICE_ID 0x1108 174#define STMMAC_DEVICE_ID 0x1108
179 175
@@ -190,10 +186,9 @@ struct pci_driver stmmac_pci_driver = {
190 .id_table = stmmac_id_table, 186 .id_table = stmmac_id_table,
191 .probe = stmmac_pci_probe, 187 .probe = stmmac_pci_probe,
192 .remove = stmmac_pci_remove, 188 .remove = stmmac_pci_remove,
193#ifdef CONFIG_PM 189 .driver = {
194 .suspend = stmmac_pci_suspend, 190 .pm = &stmmac_pm_ops,
195 .resume = stmmac_pci_resume, 191 },
196#endif
197}; 192};
198 193
199MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver"); 194MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver");