Commit d72ff8fa authored by Mike McCormack's avatar Mike McCormack Committed by David S. Miller

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: default avatarMike McCormack <mikem@ring3k.org>
Acked-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 93135a3b
...@@ -3312,15 +3312,11 @@ static int sky2_reattach(struct net_device *dev) ...@@ -3312,15 +3312,11 @@ static int sky2_reattach(struct net_device *dev)
return err; return err;
} }
static void sky2_restart(struct work_struct *work) static void sky2_all_down(struct sky2_hw *hw)
{ {
struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
u32 imask;
int i; int i;
rtnl_lock(); sky2_read32(hw, B0_IMSK);
imask = sky2_read32(hw, B0_IMSK);
sky2_write32(hw, B0_IMSK, 0); sky2_write32(hw, B0_IMSK, 0);
synchronize_irq(hw->pdev->irq); synchronize_irq(hw->pdev->irq);
napi_disable(&hw->napi); napi_disable(&hw->napi);
...@@ -3336,8 +3332,12 @@ static void sky2_restart(struct work_struct *work) ...@@ -3336,8 +3332,12 @@ static void sky2_restart(struct work_struct *work)
netif_tx_disable(dev); netif_tx_disable(dev);
sky2_hw_down(sky2); sky2_hw_down(sky2);
} }
}
sky2_reset(hw); static void sky2_all_up(struct sky2_hw *hw)
{
u32 imask = Y2_IS_BASE;
int i;
for (i = 0; i < hw->ports; i++) { for (i = 0; i < hw->ports; i++) {
struct net_device *dev = hw->dev[i]; struct net_device *dev = hw->dev[i];
...@@ -3348,6 +3348,7 @@ static void sky2_restart(struct work_struct *work) ...@@ -3348,6 +3348,7 @@ static void sky2_restart(struct work_struct *work)
sky2_hw_up(sky2); sky2_hw_up(sky2);
sky2_set_multicast(dev); sky2_set_multicast(dev);
imask |= portirq_msk[i];
netif_wake_queue(dev); netif_wake_queue(dev);
} }
...@@ -3356,6 +3357,17 @@ static void sky2_restart(struct work_struct *work) ...@@ -3356,6 +3357,17 @@ static void sky2_restart(struct work_struct *work)
sky2_read32(hw, B0_Y2_SP_LISR); sky2_read32(hw, B0_Y2_SP_LISR);
napi_enable(&hw->napi); napi_enable(&hw->napi);
}
static void sky2_restart(struct work_struct *work)
{
struct sky2_hw *hw = container_of(work, struct sky2_hw, restart_work);
rtnl_lock();
sky2_all_down(hw);
sky2_reset(hw);
sky2_all_up(hw);
rtnl_unlock(); rtnl_unlock();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment