diff mbox

[RFC,v2,3/4] net: mvmdio: slight optimisation of orion_mdio_write

Message ID 6d044f3760cd506a325d5aab1199131ade96d632.1382637156.git.leigh@solinno.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Leigh Brown Oct. 24, 2013, 6:09 p.m. UTC
Make only a single call to mutex_unlock in orion_mdio_write.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
---
 drivers/net/ethernet/marvell/mvmdio.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

David Miller Oct. 26, 2013, 5:45 a.m. UTC | #1
From: Leigh Brown <leigh@solinno.co.uk>
Date: Thu, 24 Oct 2013 19:09:33 +0100

> Make only a single call to mutex_unlock in orion_mdio_write.
> 
> Signed-off-by: Leigh Brown <leigh@solinno.co.uk>

You patch does more than what you're talking about here in your
commit message.  In particular you're also changing the interpretation
of the orion_mdio_wait_ready() return value by changing the test
from < 0 to != 0.

Even if that is a legitimate change:

1) You're not describing it in the commit message at all.

2) It's a logically separate change, so should go into a completely
   separate patch.
diff mbox

Patch

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index f053475..13f4614 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -151,10 +151,8 @@  static int orion_mdio_write(struct mii_bus *bus, int mii_id,
 	mutex_lock(&dev->lock);
 
 	ret = orion_mdio_wait_ready(bus);
-	if (ret < 0) {
-		mutex_unlock(&dev->lock);
-		return ret;
-	}
+	if (ret != 0)
+		goto out;
 
 	writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
 		(regnum << MVMDIO_SMI_PHY_REG_SHIFT)  |
@@ -162,9 +160,9 @@  static int orion_mdio_write(struct mii_bus *bus, int mii_id,
 		(value << MVMDIO_SMI_DATA_SHIFT)),
 	       dev->regs);
 
+out:
 	mutex_unlock(&dev->lock);
-
-	return 0;
+	return ret;
 }
 
 static int orion_mdio_reset(struct mii_bus *bus)