Skip to contentSkip to conversation

Fix PHY Lib support for gianfar and ucc_geth

PATCH Applied Andy Fleming 2 participants 2 messages Feb 5, 2008 – Feb 6, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix PHY Lib support for gianfar and ucc_geth

The PHY Lib now uses mutexes instead of spin_locks. ucc_geth and gianfar both grab the locks in their mdio_reset functions, so they need to use mutex_(un)lock instead. This was not caught until someone tested it on an SMP system.

---
 drivers/net/gianfar_mii.c  |    4 ++--
 drivers/net/ucc_geth_mii.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/gianfar_mii.c +2 -2
index 100bf41..6a647d9 100644
@@ -127,7 +127,7 @@ int gfar_mdio_reset(struct mii_bus *bus)
 	struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
 	unsigned int timeout = PHY_INIT_TIMEOUT;
 
-	spin_lock_bh(&bus->mdio_lock);
+	mutex_lock(&bus->mdio_lock);
 
 	/* Reset the management interface */
 	gfar_write(&regs->miimcfg, MIIMCFG_RESET);
@@ -140,7 +140,7 @@ int gfar_mdio_reset(struct mii_bus *bus)
 			timeout--)
 		cpu_relax();
 
-	spin_unlock_bh(&bus->mdio_lock);
+	mutex_unlock(&bus->mdio_lock);
 
 	if(timeout <= 0) {
 		printk(KERN_ERR "%s: The MII Bus is stuck!\n",
drivers/net/ucc_geth_mii.c +2 -2
index e3ba14a..c69e654 100644
@@ -109,7 +109,7 @@ int uec_mdio_reset(struct mii_bus *bus)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	unsigned int timeout = PHY_INIT_TIMEOUT;
 
-	spin_lock_bh(&bus->mdio_lock);
+	mutex_lock(&bus->mdio_lock);
 
 	/* Reset the management interface */
 	out_be32(&regs->miimcfg, MIIMCFG_RESET_MANAGEMENT);
@@ -121,7 +121,7 @@ int uec_mdio_reset(struct mii_bus *bus)
 	while ((in_be32(&regs->miimind) & MIIMIND_BUSY) && timeout--)
 		cpu_relax();
 
-	spin_unlock_bh(&bus->mdio_lock);
+	mutex_unlock(&bus->mdio_lock);
 
 	if (timeout <= 0) {
 		printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name);
Signature · 1 line
1.5.0.2.230.gfbe3d-dirty
Applied
#1 lore raw
Quoted 47 lines · Andy Fleming

The PHY Lib now uses mutexes instead of spin_locks. ucc_geth and gianfar both grab the locks in their mdio_reset functions, so they need to use mutex_(un)lock instead. This was not caught until someone tested it on an SMP system.

---
 drivers/net/gianfar_mii.c  |    4 ++--
 drivers/net/ucc_geth_mii.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/gianfar_mii.c +2 -2
index 100bf41..6a647d9 100644
@@ -127,7 +127,7 @@ int gfar_mdio_reset(struct mii_bus *bus)
 	struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
 	unsigned int timeout = PHY_INIT_TIMEOUT;
 
-	spin_lock_bh(&bus->mdio_lock);
+	mutex_lock(&bus->mdio_lock);
 
 	/* Reset the management interface */
 	gfar_write(&regs->miimcfg, MIIMCFG_RESET);
@@ -140,7 +140,7 @@ int gfar_mdio_reset(struct mii_bus *bus)
 			timeout--)
 		cpu_relax();
 
-	spin_unlock_bh(&bus->mdio_lock);
+	mutex_unlock(&bus->mdio_lock);
 
 	if(timeout <= 0) {
 		printk(KERN_ERR "%s: The MII Bus is stuck!\n",
drivers/net/ucc_geth_mii.c +1 -1
index e3ba14a..c69e654 100644
@@ -109,7 +109,7 @@ int uec_mdio_reset(struct mii_bus *bus)
 	struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
 	unsigned int timeout = PHY_INIT_TIMEOUT;
 
-	spin_lock_bh(&bus->mdio_lock);
+	mutex_lock(&bus->mdio_lock);
 
 	/* Reset the management interface */
 	out_be32(&regs->miimcfg, MIIMCFG_RESET_MANAGEMENT);

drivers/net/ucc_geth_mii.c int uec_mdio_reset(struct mii_bus *bus) · line 125

Quoted 6 lines
drivers/net/ucc_geth_mii.c +1 -1
@@ -121,7 +121,7 @@ int uec_mdio_reset(struct mii_bus *bus)
 	while ((in_be32(&regs->miimind) & MIIMIND_BUSY) && timeout--)
 		cpu_relax();
 
-	spin_unlock_bh(&bus->mdio_lock);
+	mutex_unlock(&bus->mdio_lock);
 

applied