@@ -3949,6 +3949,7 @@ static int nv_set_wol(struct net_device *dev, struct ethtool_wolinfo *wolinfo)
3949
3949
writel (flags , base + NvRegWakeUpFlags );
3950
3950
spin_unlock_irq (& np -> lock );
3951
3951
}
3952
+ device_set_wakeup_enable (& np -> pci_dev -> dev , np -> wolenabled );
3952
3953
return 0 ;
3953
3954
}
3954
3955
@@ -5488,14 +5489,10 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5488
5489
/* set mac address */
5489
5490
nv_copy_mac_to_hw (dev );
5490
5491
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
-
5496
5492
/* disable WOL */
5497
5493
writel (0 , base + NvRegWakeUpFlags );
5498
5494
np -> wolenabled = 0 ;
5495
+ device_set_wakeup_enable (& pci_dev -> dev , false);
5499
5496
5500
5497
if (id -> driver_data & DEV_HAS_POWER_CNTRL ) {
5501
5498
@@ -5746,8 +5743,9 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
5746
5743
}
5747
5744
5748
5745
#ifdef CONFIG_PM
5749
- static int nv_suspend (struct pci_dev * pdev , pm_message_t state )
5746
+ static int nv_suspend (struct device * device )
5750
5747
{
5748
+ struct pci_dev * pdev = to_pci_dev (device );
5751
5749
struct net_device * dev = pci_get_drvdata (pdev );
5752
5750
struct fe_priv * np = netdev_priv (dev );
5753
5751
u8 __iomem * base = get_hwbase (dev );
@@ -5763,25 +5761,17 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state)
5763
5761
for (i = 0 ; i <= np -> register_size /sizeof (u32 ); i ++ )
5764
5762
np -> saved_config_space [i ] = readl (base + i * sizeof (u32 ));
5765
5763
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 ));
5770
5764
return 0 ;
5771
5765
}
5772
5766
5773
- static int nv_resume (struct pci_dev * pdev )
5767
+ static int nv_resume (struct device * device )
5774
5768
{
5769
+ struct pci_dev * pdev = to_pci_dev (device );
5775
5770
struct net_device * dev = pci_get_drvdata (pdev );
5776
5771
struct fe_priv * np = netdev_priv (dev );
5777
5772
u8 __iomem * base = get_hwbase (dev );
5778
5773
int i , rc = 0 ;
5779
5774
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
-
5785
5775
/* restore non-pci configuration space */
5786
5776
for (i = 0 ; i <= np -> register_size /sizeof (u32 ); i ++ )
5787
5777
writel (np -> saved_config_space [i ], base + i * sizeof (u32 ));
@@ -5800,6 +5790,9 @@ static int nv_resume(struct pci_dev *pdev)
5800
5790
return rc ;
5801
5791
}
5802
5792
5793
+ static SIMPLE_DEV_PM_OPS (nv_pm_ops , nv_suspend , nv_resume ) ;
5794
+ #define NV_PM_OPS (&nv_pm_ops)
5795
+
5803
5796
static void nv_shutdown (struct pci_dev * pdev )
5804
5797
{
5805
5798
struct net_device * dev = pci_get_drvdata (pdev );
@@ -5822,15 +5815,13 @@ static void nv_shutdown(struct pci_dev *pdev)
5822
5815
* only put the device into D3 if we really go for poweroff.
5823
5816
*/
5824
5817
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 );
5827
5819
pci_set_power_state (pdev , PCI_D3hot );
5828
5820
}
5829
5821
}
5830
5822
#else
5831
- #define nv_suspend NULL
5823
+ #define NV_PM_OPS NULL
5832
5824
#define nv_shutdown NULL
5833
- #define nv_resume NULL
5834
5825
#endif /* CONFIG_PM */
5835
5826
5836
5827
static DEFINE_PCI_DEVICE_TABLE (pci_tbl ) = {
@@ -6002,9 +5993,8 @@ static struct pci_driver driver = {
6002
5993
.id_table = pci_tbl ,
6003
5994
.probe = nv_probe ,
6004
5995
.remove = __devexit_p (nv_remove ),
6005
- .suspend = nv_suspend ,
6006
- .resume = nv_resume ,
6007
5996
.shutdown = nv_shutdown ,
5997
+ .driver .pm = NV_PM_OPS ,
6008
5998
};
6009
5999
6010
6000
static int __init init_nic (void )
0 commit comments