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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 6b87c7a5c906..765c8f063512 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -187,12 +187,11 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
187 return v; 187 return v;
188} 188}
189 189
190static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) 190static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
191{ 191{
192 u16 power_control; 192 u16 power_control;
193 u32 reg1; 193 u32 reg1;
194 int vaux; 194 int vaux;
195 int ret = 0;
196 195
197 pr_debug("sky2_set_power_state %d\n", state); 196 pr_debug("sky2_set_power_state %d\n", state);
198 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 197 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
@@ -275,12 +274,10 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
275 break; 274 break;
276 default: 275 default:
277 printk(KERN_ERR PFX "Unknown power state %d\n", state); 276 printk(KERN_ERR PFX "Unknown power state %d\n", state);
278 ret = -1;
279 } 277 }
280 278
281 sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control); 279 sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control);
282 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 280 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
283 return ret;
284} 281}
285 282
286static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) 283static void sky2_phy_reset(struct sky2_hw *hw, unsigned port)
@@ -3428,6 +3425,10 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
3428{ 3425{
3429 struct sky2_hw *hw = pci_get_drvdata(pdev); 3426 struct sky2_hw *hw = pci_get_drvdata(pdev);
3430 int i; 3427 int i;
3428 pci_power_t pstate = pci_choose_state(pdev, state);
3429
3430 if (!(pstate == PCI_D3hot || pstate == PCI_D3cold))
3431 return -EINVAL;
3431 3432
3432 for (i = 0; i < 2; i++) { 3433 for (i = 0; i < 2; i++) {
3433 struct net_device *dev = hw->dev[i]; 3434 struct net_device *dev = hw->dev[i];
@@ -3442,7 +3443,8 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
3442 } 3443 }
3443 3444
3444 pci_save_state(pdev); 3445 pci_save_state(pdev);
3445 return sky2_set_power_state(hw, pci_choose_state(pdev, state)); 3446 sky2_set_power_state(hw, pstate);
3447 return 0;
3446} 3448}
3447 3449
3448static int sky2_resume(struct pci_dev *pdev) 3450static int sky2_resume(struct pci_dev *pdev)
@@ -3452,9 +3454,7 @@ static int sky2_resume(struct pci_dev *pdev)
3452 3454
3453 pci_restore_state(pdev); 3455 pci_restore_state(pdev);
3454 pci_enable_wake(pdev, PCI_D0, 0); 3456 pci_enable_wake(pdev, PCI_D0, 0);
3455 err = sky2_set_power_state(hw, PCI_D0); 3457 sky2_set_power_state(hw, PCI_D0);
3456 if (err)
3457 goto out;
3458 3458
3459 err = sky2_reset(hw); 3459 err = sky2_reset(hw);
3460 if (err) 3460 if (err)