diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sky2.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 7023bbe545ee..bc15940ce1bc 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3949,7 +3949,7 @@ static __exit void sky2_debug_cleanup(void) | |||
3949 | /* Initialize network device */ | 3949 | /* Initialize network device */ |
3950 | static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | 3950 | static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, |
3951 | unsigned port, | 3951 | unsigned port, |
3952 | int highmem) | 3952 | int highmem, int wol) |
3953 | { | 3953 | { |
3954 | struct sky2_port *sky2; | 3954 | struct sky2_port *sky2; |
3955 | struct net_device *dev = alloc_etherdev(sizeof(*sky2)); | 3955 | struct net_device *dev = alloc_etherdev(sizeof(*sky2)); |
@@ -3989,7 +3989,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
3989 | sky2->speed = -1; | 3989 | sky2->speed = -1; |
3990 | sky2->advertising = sky2_supported_modes(hw); | 3990 | sky2->advertising = sky2_supported_modes(hw); |
3991 | sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); | 3991 | sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); |
3992 | sky2->wol = sky2_wol_supported(hw) & WAKE_MAGIC; | 3992 | sky2->wol = wol; |
3993 | 3993 | ||
3994 | spin_lock_init(&sky2->phy_lock); | 3994 | spin_lock_init(&sky2->phy_lock); |
3995 | sky2->tx_pending = TX_DEF_PENDING; | 3995 | sky2->tx_pending = TX_DEF_PENDING; |
@@ -4086,12 +4086,24 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) | |||
4086 | return err; | 4086 | return err; |
4087 | } | 4087 | } |
4088 | 4088 | ||
4089 | static int __devinit pci_wake_enabled(struct pci_dev *dev) | ||
4090 | { | ||
4091 | int pm = pci_find_capability(dev, PCI_CAP_ID_PM); | ||
4092 | u16 value; | ||
4093 | |||
4094 | if (!pm) | ||
4095 | return 0; | ||
4096 | if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value)) | ||
4097 | return 0; | ||
4098 | return value & PCI_PM_CTRL_PME_ENABLE; | ||
4099 | } | ||
4100 | |||
4089 | static int __devinit sky2_probe(struct pci_dev *pdev, | 4101 | static int __devinit sky2_probe(struct pci_dev *pdev, |
4090 | const struct pci_device_id *ent) | 4102 | const struct pci_device_id *ent) |
4091 | { | 4103 | { |
4092 | struct net_device *dev; | 4104 | struct net_device *dev; |
4093 | struct sky2_hw *hw; | 4105 | struct sky2_hw *hw; |
4094 | int err, using_dac = 0; | 4106 | int err, using_dac = 0, wol_default; |
4095 | 4107 | ||
4096 | err = pci_enable_device(pdev); | 4108 | err = pci_enable_device(pdev); |
4097 | if (err) { | 4109 | if (err) { |
@@ -4124,6 +4136,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4124 | } | 4136 | } |
4125 | } | 4137 | } |
4126 | 4138 | ||
4139 | wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0; | ||
4140 | |||
4127 | err = -ENOMEM; | 4141 | err = -ENOMEM; |
4128 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); | 4142 | hw = kzalloc(sizeof(*hw), GFP_KERNEL); |
4129 | if (!hw) { | 4143 | if (!hw) { |
@@ -4167,7 +4181,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4167 | 4181 | ||
4168 | sky2_reset(hw); | 4182 | sky2_reset(hw); |
4169 | 4183 | ||
4170 | dev = sky2_init_netdev(hw, 0, using_dac); | 4184 | dev = sky2_init_netdev(hw, 0, using_dac, wol_default); |
4171 | if (!dev) { | 4185 | if (!dev) { |
4172 | err = -ENOMEM; | 4186 | err = -ENOMEM; |
4173 | goto err_out_free_pci; | 4187 | goto err_out_free_pci; |
@@ -4204,7 +4218,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4204 | if (hw->ports > 1) { | 4218 | if (hw->ports > 1) { |
4205 | struct net_device *dev1; | 4219 | struct net_device *dev1; |
4206 | 4220 | ||
4207 | dev1 = sky2_init_netdev(hw, 1, using_dac); | 4221 | dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default); |
4208 | if (!dev1) | 4222 | if (!dev1) |
4209 | dev_warn(&pdev->dev, "allocation for second device failed\n"); | 4223 | dev_warn(&pdev->dev, "allocation for second device failed\n"); |
4210 | else if ((err = register_netdev(dev1))) { | 4224 | else if ((err = register_netdev(dev1))) { |