igb: Use device_set_wakeup_enable

Since dev->power.should_wakeup bit is used by the PCI core to
decide whether the device should wake up the system from sleep
states, set/unset this bit whenever WOL is enabled/disabled using
igb_set_wol(). Accordingly, use device_can_wakeup() for checking
if wake-up is supported by the device.

Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by \"Rafael J. Wysocki\ and committed by David S. Miller e1b86d84 de126489

+7 -2
+6 -2
drivers/net/igb/igb_ethtool.c
··· 1776 1777 /* this function will set ->supported = 0 and return 1 if wol is not 1778 * supported by this hardware */ 1779 - if (igb_wol_exclusion(adapter, wol)) 1780 return; 1781 1782 /* apply any specific unsupported masks here */ ··· 1806 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) 1807 return -EOPNOTSUPP; 1808 1809 - if (igb_wol_exclusion(adapter, wol)) 1810 return wol->wolopts ? -EOPNOTSUPP : 0; 1811 1812 switch (hw->device_id) { ··· 1826 adapter->wol |= E1000_WUFC_BC; 1827 if (wol->wolopts & WAKE_MAGIC) 1828 adapter->wol |= E1000_WUFC_MAG; 1829 1830 return 0; 1831 }
··· 1776 1777 /* this function will set ->supported = 0 and return 1 if wol is not 1778 * supported by this hardware */ 1779 + if (igb_wol_exclusion(adapter, wol) || 1780 + !device_can_wakeup(&adapter->pdev->dev)) 1781 return; 1782 1783 /* apply any specific unsupported masks here */ ··· 1805 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) 1806 return -EOPNOTSUPP; 1807 1808 + if (igb_wol_exclusion(adapter, wol) || 1809 + !device_can_wakeup(&adapter->pdev->dev)) 1810 return wol->wolopts ? -EOPNOTSUPP : 0; 1811 1812 switch (hw->device_id) { ··· 1824 adapter->wol |= E1000_WUFC_BC; 1825 if (wol->wolopts & WAKE_MAGIC) 1826 adapter->wol |= E1000_WUFC_MAG; 1827 + 1828 + device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 1829 1830 return 0; 1831 }
+1
drivers/net/igb/igb_main.c
··· 1244 1245 /* initialize the wol settings based on the eeprom settings */ 1246 adapter->wol = adapter->eeprom_wol; 1247 1248 /* reset the hardware with the new settings */ 1249 igb_reset(adapter);
··· 1244 1245 /* initialize the wol settings based on the eeprom settings */ 1246 adapter->wol = adapter->eeprom_wol; 1247 + device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 1248 1249 /* reset the hardware with the new settings */ 1250 igb_reset(adapter);