Skip to contentSkip to conversation

Fix error checking in Vitesse IRQ config

PATCH In review Andy Fleming 4 participants 5 messages Jul 18, 2007 – Jul 19, 2007

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

PATCH 1/2 Fix error checking in Vitesse IRQ config

phy_read() returns a negative number if there's an error, but the error-checking code in the Vitesse driver's config_intr function triggers if phy_read() returns non-zero. Correct that.

---
I made a really stupid mistake in the 4 patches I sent out, earlier. I thought those patches had been tested, but they hadn't been. This one corrects a tiny error in the patch, and they have now been tested. As before this change can be pulled from:

http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev

Really, REALLY sorry about that. I have been given a paper bag of appropriate size and shape to fit over my head.

 drivers/net/phy/vitesse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/phy/vitesse.c +1 -1
index 6a53856..8874497 100644
@@ -109,7 +109,7 @@ static int vsc824x_config_intr(struct phy_device *phydev)
 		 */
 		err = phy_read(phydev, MII_VSC8244_ISTAT);
 
-		if (err)
+		if (err < 0)
 			return err;
 
 		err = phy_write(phydev, MII_VSC8244_IMASK, 0);
Signature · 1 line
1.5.0.2.230.gfbe3d-dirty
#1 lore raw
Quoted 24 lines · Andy Fleming

phy_read() returns a negative number if there's an error, but the error-checking code in the Vitesse driver's config_intr function triggers if phy_read() returns non-zero. Correct that.

---
I made a really stupid mistake in the 4 patches I sent out, earlier. I thought those patches had been tested, but they hadn't been. This one corrects a tiny error in the patch, and they have now been tested. As before this change can be pulled from:

http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev

Really, REALLY sorry about that. I have been given a paper bag of appropriate size and shape to fit over my head.

 drivers/net/phy/vitesse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/phy/vitesse.c +0 -0
index 6a53856..8874497 100644

drivers/net/phy/vitesse.c static int vsc824x_config_intr(struct phy_device *phydev) · line 113

Quoted 6 lines
drivers/net/phy/vitesse.c +1 -1
@@ -109,7 +109,7 @@ static int vsc824x_config_intr(struct phy_device *phydev)
                 */
                err = phy_read(phydev, MII_VSC8244_ISTAT);
 
-               if (err)
+               if (err < 0)
                        return err;

but would that mean, if phy_read returns > 0 it is a success?

thanks

Quoted 10 lines
drivers/net/phy/vitesse.c +0 -1
                err = phy_write(phydev, MII_VSC8244_IMASK, 0);
--

1.5.0.2.230.gfbe3d-dirty

-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Pradeep
#2 lore raw
Quoted 7 lines · pradeep singh

drivers/net/phy/vitesse.c static int vsc824x_config_intr(struct phy_device *phydev) · line 113

Quoted 3 lines · Andy Fleming
drivers/net/phy/vitesse.c +1 -1
-               if (err)
+               if (err < 0)
                        return err;

but would that mean, if phy_read returns > 0 it is a success?

Yes. phy_read() returns a 32-bit value. If there's an error, it returns a negative number. If not, it returns whatever was in the register (which is only 16 bits)

phy_write() returns 0 on success, and non-zero, otherwise. In hindsight, it would have been better to be consistent.

Andy

Acked-by on v1 1/2
#3 lore raw
In reply to Andy Fleming

drivers/net/phy/vitesse.c

Quoted 21 lines · Andy Fleming

phy_read() returns a negative number if there's an error, but the error-checking code in the Vitesse driver's config_intr function triggers if phy_read() returns non-zero. Correct that.

---
I made a really stupid mistake in the 4 patches I sent out, earlier. I thought those patches had been tested, but they hadn't been. This one corrects a tiny error in the patch, and they have now been tested. As before this change can be pulled from:

http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev

Really, REALLY sorry about that. I have been given a paper bag of appropriate size and shape to fit over my head.

 drivers/net/phy/vitesse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/phy/vitesse.c +0 -0
index 6a53856..8874497 100644

Tested on the 8641HPCN.

Thanks,
jdl

#4 lore raw
In reply to Andy Fleming
Quoted 5 lines · Andy Fleming

phy_read() returns a negative number if there's an error, but the error-checking code in the Vitesse driver's config_intr function triggers if phy_read() returns non-zero. Correct that.

Jeff,

Can you make sure to send this to linus since its need to properly fix the Vitesse phy's used on the 8641HPCN and 8544 DS boards.

thanks

- k

Quoted 35 lines

---
I made a really stupid mistake in the 4 patches I sent out, earlier. I thought those patches had been tested, but they hadn't been. This one corrects a tiny error in the patch, and they have now been tested. As before this change can be pulled from:

http://opensource.freescale.com/pub/scm/linux-2.6-85xx.git netdev

Really, REALLY sorry about that. I have been given a paper bag of appropriate size and shape to fit over my head.

 drivers/net/phy/vitesse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/phy/vitesse.c +1 -1
index 6a53856..8874497 100644
@@ -109,7 +109,7 @@ static int vsc824x_config_intr(struct  
 phy_device *phydev)
 		 */
 		err = phy_read(phydev, MII_VSC8244_ISTAT);
 
-		if (err)
+		if (err < 0)
 			return err;
 

err = phy_write(phydev, MII_VSC8244_IMASK, 0);

Signature · 6 lines
1.5.0.2.230.gfbe3d-dirty

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html