aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index bc15940ce1bc..7023bbe545ee 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 */
3950static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, 3950static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3951 unsigned port, 3951 unsigned port,
3952 int highmem, int wol) 3952 int highmem)
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 = wol; 3992 sky2->wol = sky2_wol_supported(hw) & WAKE_MAGIC;
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,24 +4086,12 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
4086 return err; 4086 return err;
4087} 4087}
4088 4088
4089static 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
4101static int __devinit sky2_probe(struct pci_dev *pdev, 4089static int __devinit sky2_probe(struct pci_dev *pdev,
4102 const struct pci_device_id *ent) 4090 const struct pci_device_id *ent)
4103{ 4091{
4104 struct net_device *dev; 4092 struct net_device *dev;
4105 struct sky2_hw *hw; 4093 struct sky2_hw *hw;
4106 int err, using_dac = 0, wol_default; 4094 int err, using_dac = 0;
4107 4095
4108 err = pci_enable_device(pdev); 4096 err = pci_enable_device(pdev);
4109 if (err) { 4097 if (err) {
@@ -4136,8 +4124,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4136 } 4124 }
4137 } 4125 }
4138 4126
4139 wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
4140
4141 err = -ENOMEM; 4127 err = -ENOMEM;
4142 hw = kzalloc(sizeof(*hw), GFP_KERNEL); 4128 hw = kzalloc(sizeof(*hw), GFP_KERNEL);
4143 if (!hw) { 4129 if (!hw) {
@@ -4181,7 +4167,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4181 4167
4182 sky2_reset(hw); 4168 sky2_reset(hw);
4183 4169
4184 dev = sky2_init_netdev(hw, 0, using_dac, wol_default); 4170 dev = sky2_init_netdev(hw, 0, using_dac);
4185 if (!dev) { 4171 if (!dev) {
4186 err = -ENOMEM; 4172 err = -ENOMEM;
4187 goto err_out_free_pci; 4173 goto err_out_free_pci;
@@ -4218,7 +4204,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4218 if (hw->ports > 1) { 4204 if (hw->ports > 1) {
4219 struct net_device *dev1; 4205 struct net_device *dev1;
4220 4206
4221 dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default); 4207 dev1 = sky2_init_netdev(hw, 1, using_dac);
4222 if (!dev1) 4208 if (!dev1)
4223 dev_warn(&pdev->dev, "allocation for second device failed\n"); 4209 dev_warn(&pdev->dev, "allocation for second device failed\n");
4224 else if ((err = register_netdev(dev1))) { 4210 else if ((err = register_netdev(dev1))) {