Skip to content

Commit

Permalink
net: mvmdio: slight optimisation of orion_mdio_write
Browse files Browse the repository at this point in the history
Make only a single call to mutex_unlock in orion_mdio_write.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Leigh Brown authored and David S. Miller committed Oct 29, 2013
1 parent 839f46b commit 526edcf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/net/ethernet/marvell/mvmdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,18 @@ 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) |
MVMDIO_SMI_WRITE_OPERATION |
(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)
Expand Down

0 comments on commit 526edcf

Please sign in to comment.