diff options
author | Mike McCormack <mikem@ring3k.org> | 2010-05-13 02:12:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-14 06:06:21 -0400 |
commit | d72ff8fa7f8b344382963721f842256825c4660b (patch) | |
tree | 669282b67c3c37940141aa4ea52259d2f3f6358b /drivers/net/sky2.c | |
parent | 93135a3be0d909fabca9c4329177f71ae71b6847 (diff) |
sky2: Refactor down/up code out of sky2_restart()
Code to bring down all sky2 interfaces and bring it up
again can be reused in sky2_suspend and sky2_resume.
Factor the code to bring the interfaces down into
sky2_all_down and the up code into sky2_all_up.
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index f13a45f1db68..cc6f312a412f 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3312,15 +3312,11 @@ static int sky2_reattach(struct net_device *dev) | |||
3312 | return err; | 3312 | return err; |
3313 | } | 3313 | } |
3314 | 3314 | ||
3315 | static void sky2_restart(struct work_struct *work) | 3315 | static void sky2_all_down(struct sky2_hw *hw) |
3316 | { | 3316 | { |
3317 | struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work); | ||
3318 | u32 imask; | ||
3319 | int i; | 3317 | int i; |
3320 | 3318 | ||
3321 | rtnl_lock(); | 3319 | sky2_read32(hw, B0_IMSK); |
3322 | |||
3323 | imask = sky2_read32(hw, B0_IMSK); | ||
3324 | sky2_write32(hw, B0_IMSK, 0); | 3320 | sky2_write32(hw, B0_IMSK, 0); |
3325 | synchronize_irq(hw->pdev->irq); | 3321 | synchronize_irq(hw->pdev->irq); |
3326 | napi_disable(&hw->napi); | 3322 | napi_disable(&hw->napi); |
@@ -3336,8 +3332,12 @@ static void sky2_restart(struct work_struct *work) | |||
3336 | netif_tx_disable(dev); | 3332 | netif_tx_disable(dev); |
3337 | sky2_hw_down(sky2); | 3333 | sky2_hw_down(sky2); |
3338 | } | 3334 | } |
3335 | } | ||
3339 | 3336 | ||
3340 | sky2_reset(hw); | 3337 | static void sky2_all_up(struct sky2_hw *hw) |
3338 | { | ||
3339 | u32 imask = Y2_IS_BASE; | ||
3340 | int i; | ||
3341 | 3341 | ||
3342 | for (i = 0; i < hw->ports; i++) { | 3342 | for (i = 0; i < hw->ports; i++) { |
3343 | struct net_device *dev = hw->dev[i]; | 3343 | struct net_device *dev = hw->dev[i]; |
@@ -3348,6 +3348,7 @@ static void sky2_restart(struct work_struct *work) | |||
3348 | 3348 | ||
3349 | sky2_hw_up(sky2); | 3349 | sky2_hw_up(sky2); |
3350 | sky2_set_multicast(dev); | 3350 | sky2_set_multicast(dev); |
3351 | imask |= portirq_msk[i]; | ||
3351 | netif_wake_queue(dev); | 3352 | netif_wake_queue(dev); |
3352 | } | 3353 | } |
3353 | 3354 | ||
@@ -3356,6 +3357,17 @@ static void sky2_restart(struct work_struct *work) | |||
3356 | 3357 | ||
3357 | sky2_read32(hw, B0_Y2_SP_LISR); | 3358 | sky2_read32(hw, B0_Y2_SP_LISR); |
3358 | napi_enable(&hw->napi); | 3359 | napi_enable(&hw->napi); |
3360 | } | ||
3361 | |||
3362 | static void sky2_restart(struct work_struct *work) | ||
3363 | { | ||
3364 | struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work); | ||
3365 | |||
3366 | rtnl_lock(); | ||
3367 | |||
3368 | sky2_all_down(hw); | ||
3369 | sky2_reset(hw); | ||
3370 | sky2_all_up(hw); | ||
3359 | 3371 | ||
3360 | rtnl_unlock(); | 3372 | rtnl_unlock(); |
3361 | } | 3373 | } |