3c59x: fix regression from patch "Add ethtool WOL support"

This patch (commit 690a1f2002a3091bd18a501f46c9530f10481463) added a
new call site for acpi_set_WOL() without checking that the function is
actually suitable to be called via

vortex_set_wol+0xcd/0xe0 [3c59x]
dev_ethtool+0xa5a/0xb70
dev_ioctl+0x2e0/0x4b0
T.961+0x49/0x50
sock_ioctl+0x47/0x290
do_vfs_ioctl+0x7f/0x340
sys_ioctl+0x80/0xa0
system_call_fastpath+0x16/0x1b

i.e. outside of code paths run when the device is not yet enabled or
already disabled. In particular, putting the device into D3hot is a
pretty bad idea when it was already brought up.

Furthermore, all prior callers of the function made sure they're
actually dealing with a PCI device, while the newly added one didn't.

In the same spirit, the .get_wol handler shouldn't indicate support
for WOL for non-PCI devices.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Jan Beulich and committed by David S. Miller 3fd6c88e 2cc6d2bf

+10
+10
drivers/net/3c59x.c
··· 2942 { 2943 struct vortex_private *vp = netdev_priv(dev); 2944 2945 wol->supported = WAKE_MAGIC; 2946 2947 wol->wolopts = 0; ··· 2955 static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 2956 { 2957 struct vortex_private *vp = netdev_priv(dev); 2958 if (wol->wolopts & ~WAKE_MAGIC) 2959 return -EINVAL; 2960 ··· 3207 vp->enable_wol = 0; 3208 return; 3209 } 3210 3211 /* Change the power state to D3; RxEnable doesn't take effect. */ 3212 pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot);
··· 2942 { 2943 struct vortex_private *vp = netdev_priv(dev); 2944 2945 + if (!VORTEX_PCI(vp)) 2946 + return; 2947 + 2948 wol->supported = WAKE_MAGIC; 2949 2950 wol->wolopts = 0; ··· 2952 static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 2953 { 2954 struct vortex_private *vp = netdev_priv(dev); 2955 + 2956 + if (!VORTEX_PCI(vp)) 2957 + return -EOPNOTSUPP; 2958 + 2959 if (wol->wolopts & ~WAKE_MAGIC) 2960 return -EINVAL; 2961 ··· 3200 vp->enable_wol = 0; 3201 return; 3202 } 3203 + 3204 + if (VORTEX_PCI(vp)->current_state < PCI_D3hot) 3205 + return; 3206 3207 /* Change the power state to D3; RxEnable doesn't take effect. */ 3208 pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot);