diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-10-12 23:59:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-12 23:59:48 -0400 |
commit | 9d731d77c9794bb0a264f58d35949a1ab6dcc41c (patch) | |
tree | 748f106a5c8858c2959dc1683edc3a90ae3bb284 /drivers/net/sky2.c | |
parent | 738e1e694bf6d9e965ba0ce2667a1bec5780a172 (diff) |
sky2: Fix WOL regression
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
sky2_set_wol().
Remove an open-coded reference to the standard PCI PM registers that
is not used any more.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 3805b9318be7..3813d15e2df7 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3034,7 +3034,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
3034 | struct sky2_port *sky2 = netdev_priv(dev); | 3034 | struct sky2_port *sky2 = netdev_priv(dev); |
3035 | struct sky2_hw *hw = sky2->hw; | 3035 | struct sky2_hw *hw = sky2->hw; |
3036 | 3036 | ||
3037 | if (wol->wolopts & ~sky2_wol_supported(sky2->hw)) | 3037 | if ((wol->wolopts & ~sky2_wol_supported(sky2->hw)) |
3038 | || !device_can_wakeup(&hw->pdev->dev)) | ||
3038 | return -EOPNOTSUPP; | 3039 | return -EOPNOTSUPP; |
3039 | 3040 | ||
3040 | sky2->wol = wol->wolopts; | 3041 | sky2->wol = wol->wolopts; |
@@ -3045,6 +3046,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
3045 | sky2_write32(hw, B0_CTST, sky2->wol | 3046 | sky2_write32(hw, B0_CTST, sky2->wol |
3046 | ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); | 3047 | ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); |
3047 | 3048 | ||
3049 | device_set_wakeup_enable(&hw->pdev->dev, sky2->wol); | ||
3050 | |||
3048 | if (!netif_running(dev)) | 3051 | if (!netif_running(dev)) |
3049 | sky2_wol_init(sky2); | 3052 | sky2_wol_init(sky2); |
3050 | return 0; | 3053 | return 0; |
@@ -4179,18 +4182,6 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) | |||
4179 | return err; | 4182 | return err; |
4180 | } | 4183 | } |
4181 | 4184 | ||
4182 | static int __devinit pci_wake_enabled(struct pci_dev *dev) | ||
4183 | { | ||
4184 | int pm = pci_find_capability(dev, PCI_CAP_ID_PM); | ||
4185 | u16 value; | ||
4186 | |||
4187 | if (!pm) | ||
4188 | return 0; | ||
4189 | if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value)) | ||
4190 | return 0; | ||
4191 | return value & PCI_PM_CTRL_PME_ENABLE; | ||
4192 | } | ||
4193 | |||
4194 | /* | 4185 | /* |
4195 | * Read and parse the first part of Vital Product Data | 4186 | * Read and parse the first part of Vital Product Data |
4196 | */ | 4187 | */ |
@@ -4314,7 +4305,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4314 | } | 4305 | } |
4315 | } | 4306 | } |
4316 | 4307 | ||
4317 | wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0; | 4308 | wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0; |
4318 | 4309 | ||
4319 | err = -ENOMEM; | 4310 | err = -ENOMEM; |
4320 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); | 4311 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); |