Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113720
b: refs/heads/master
c: 9d731d7
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and David S. Miller committed Oct 13, 2008
1 parent 095337f commit ddba8fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 738e1e694bf6d9e965ba0ce2667a1bec5780a172
refs/heads/master: 9d731d77c9794bb0a264f58d35949a1ab6dcc41c
19 changes: 5 additions & 14 deletions trunk/drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3034,7 +3034,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
struct sky2_port *sky2 = netdev_priv(dev);
struct sky2_hw *hw = sky2->hw;

if (wol->wolopts & ~sky2_wol_supported(sky2->hw))
if ((wol->wolopts & ~sky2_wol_supported(sky2->hw))
|| !device_can_wakeup(&hw->pdev->dev))
return -EOPNOTSUPP;

sky2->wol = wol->wolopts;
Expand All @@ -3045,6 +3046,8 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
sky2_write32(hw, B0_CTST, sky2->wol
? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);

device_set_wakeup_enable(&hw->pdev->dev, sky2->wol);

if (!netif_running(dev))
sky2_wol_init(sky2);
return 0;
Expand Down Expand Up @@ -4179,18 +4182,6 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
return err;
}

static int __devinit pci_wake_enabled(struct pci_dev *dev)
{
int pm = pci_find_capability(dev, PCI_CAP_ID_PM);
u16 value;

if (!pm)
return 0;
if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
return 0;
return value & PCI_PM_CTRL_PME_ENABLE;
}

/*
* Read and parse the first part of Vital Product Data
*/
Expand Down Expand Up @@ -4314,7 +4305,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
}
}

wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0;

err = -ENOMEM;
hw = kzalloc(sizeof(*hw), GFP_KERNEL);
Expand Down

0 comments on commit ddba8fd

Please sign in to comment.