tg3: Fix failure to enable WoL by default when possible

tg3 is supposed to enable WoL by default on adapters which support
that, but it fails to do so unless the adapter's
/sys/devices/.../power/wakeup file contains 'enabled' during the
initialization of the adapter. Fix that by making tg3 use
device_set_wakeup_enable() to enable wakeup automatically whenever
WoL should be enabled by default.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Rafael J. Wysocki and committed by David S. Miller 6fdbab9d 41c31f31

+6 -2
+6 -2
drivers/net/tg3.c
··· 12327 if (val & VCPU_CFGSHDW_ASPM_DBNC) 12328 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND; 12329 if ((val & VCPU_CFGSHDW_WOL_ENABLE) && 12330 - (val & VCPU_CFGSHDW_WOL_MAGPKT)) 12331 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 12332 goto done; 12333 } 12334 ··· 12463 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP; 12464 12465 if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) && 12466 - (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) 12467 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 12468 12469 if (cfg2 & (1 << 17)) 12470 tp->phy_flags |= TG3_PHYFLG_CAPACITIVE_COUPLING;
··· 12327 if (val & VCPU_CFGSHDW_ASPM_DBNC) 12328 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND; 12329 if ((val & VCPU_CFGSHDW_WOL_ENABLE) && 12330 + (val & VCPU_CFGSHDW_WOL_MAGPKT)) { 12331 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 12332 + device_set_wakeup_enable(&tp->pdev->dev, true); 12333 + } 12334 goto done; 12335 } 12336 ··· 12461 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP; 12462 12463 if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) && 12464 + (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) { 12465 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 12466 + device_set_wakeup_enable(&tp->pdev->dev, true); 12467 + } 12468 12469 if (cfg2 & (1 << 17)) 12470 tp->phy_flags |= TG3_PHYFLG_CAPACITIVE_COUPLING;