Patchwork [4/9] sky2: hold spinlock around phy_power_down

login
register
mail settings
Submitter stephen hemminger
Date Aug. 14, 2009, 3:15 p.m.
Message ID <20090814151608.197690244@vyatta.com>
Download mbox | patch
Permalink /patch/31408/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Aug. 14, 2009, 3:15 p.m.
Avoid any possible problems with accessing PHY registers on shutdown.
This is a purely theoretical issue and is not related to any of the
outstanding bug reports. Since receiver and transmitter are already
shutdown and phy interrupts for this device are already disabled, 
there should already be enough protection. Suggested by Mike McCormack.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Patch

--- a/drivers/net/sky2.c	2009-08-14 07:58:45.736296852 -0700
+++ b/drivers/net/sky2.c	2009-08-14 07:58:46.664005121 -0700
@@ -1882,7 +1882,9 @@  static int sky2_down(struct net_device *
 	synchronize_irq(hw->pdev->irq);
 	napi_synchronize(&hw->napi);
 
+	spin_lock_bh(&sky2->phy_lock);
 	sky2_phy_power_down(hw, port);
+	spin_unlock_bh(&sky2->phy_lock);
 
 	/* turn off LED's */
 	sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);