@@ -3949,6 +3949,7 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
39493949 writel (flags , base + NvRegWakeUpFlags );
39503950 spin_unlock_irq (& np -> lock );
39513951 }
3952+ device_set_wakeup_enable (& np -> pci_dev -> dev , np -> wolenabled );
39523953 return 0 ;
39533954}
39543955
@@ -5488,14 +5489,10 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
54885489 /* set mac address */
54895490 nv_copy_mac_to_hw (dev );
54905491
5491- /* Workaround current PCI init glitch: wakeup bits aren't
5492- * being set from PCI PM capability.
5493- */
5494- device_init_wakeup (& pci_dev -> dev , 1 );
5495-
54965492 /* disable WOL */
54975493 writel (0 , base + NvRegWakeUpFlags );
54985494 np -> wolenabled = 0 ;
5495+ device_set_wakeup_enable (& pci_dev -> dev , false);
54995496
55005497 if (id -> driver_data & DEV_HAS_POWER_CNTRL ) {
55015498
@@ -5746,8 +5743,9 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
57465743}
57475744
57485745#ifdef CONFIG_PM
5749- static int nv_suspend (struct pci_dev * pdev , pm_message_t state )
5746+ static int nv_suspend (struct device * device )
57505747{
5748+ struct pci_dev * pdev = to_pci_dev (device );
57515749 struct net_device * dev = pci_get_drvdata (pdev );
57525750 struct fe_priv * np = netdev_priv (dev );
57535751 u8 __iomem * base = get_hwbase (dev );
@@ -5763,25 +5761,17 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
57635761 for (i = 0 ; i <= np -> register_size /sizeof (u32 ); i ++ )
57645762 np -> saved_config_space [i ] = readl (base + i * sizeof (u32 ));
57655763
5766- pci_save_state (pdev );
5767- pci_enable_wake (pdev , pci_choose_state (pdev , state ), np -> wolenabled );
5768- pci_disable_device (pdev );
5769- pci_set_power_state (pdev , pci_choose_state (pdev , state ));
57705764 return 0 ;
57715765}
57725766
5773- static int nv_resume (struct pci_dev * pdev )
5767+ static int nv_resume (struct device * device )
57745768{
5769+ struct pci_dev * pdev = to_pci_dev (device );
57755770 struct net_device * dev = pci_get_drvdata (pdev );
57765771 struct fe_priv * np = netdev_priv (dev );
57775772 u8 __iomem * base = get_hwbase (dev );
57785773 int i , rc = 0 ;
57795774
5780- pci_set_power_state (pdev , PCI_D0 );
5781- pci_restore_state (pdev );
5782- /* ack any pending wake events, disable PME */
5783- pci_enable_wake (pdev , PCI_D0 , 0 );
5784-
57855775 /* restore non-pci configuration space */
57865776 for (i = 0 ; i <= np -> register_size /sizeof (u32 ); i ++ )
57875777 writel (np -> saved_config_space [i ], base + i * sizeof (u32 ));
@@ -5800,6 +5790,9 @@ static int nv_resume(struct pci_dev *pdev)
58005790 return rc ;
58015791}
58025792
5793+ static SIMPLE_DEV_PM_OPS (nv_pm_ops , nv_suspend , nv_resume ) ;
5794+ #define NV_PM_OPS (&nv_pm_ops)
5795+
58035796static void nv_shutdown (struct pci_dev * pdev )
58045797{
58055798 struct net_device * dev = pci_get_drvdata (pdev );
@@ -5822,15 +5815,13 @@ static void nv_shutdown(struct pci_dev *pdev)
58225815 * only put the device into D3 if we really go for poweroff.
58235816 */
58245817 if (system_state == SYSTEM_POWER_OFF ) {
5825- if (pci_enable_wake (pdev , PCI_D3cold , np -> wolenabled ))
5826- pci_enable_wake (pdev , PCI_D3hot , np -> wolenabled );
5818+ pci_wake_from_d3 (pdev , np -> wolenabled );
58275819 pci_set_power_state (pdev , PCI_D3hot );
58285820 }
58295821}
58305822#else
5831- #define nv_suspend NULL
5823+ #define NV_PM_OPS NULL
58325824#define nv_shutdown NULL
5833- #define nv_resume NULL
58345825#endif /* CONFIG_PM */
58355826
58365827static DEFINE_PCI_DEVICE_TABLE (pci_tbl ) = {
@@ -6002,9 +5993,8 @@ static struct pci_driver driver = {
60025993 .id_table = pci_tbl ,
60035994 .probe = nv_probe ,
60045995 .remove = __devexit_p (nv_remove ),
6005- .suspend = nv_suspend ,
6006- .resume = nv_resume ,
60075996 .shutdown = nv_shutdown ,
5997+ .driver .pm = NV_PM_OPS ,
60085998};
60095999
60106000static int __init init_nic (void )
0 commit comments