net: mvmdio: simplify the smi read and write error paths
Cosmetic patch simplifying the smi read and write error paths. It also align their error paths with the ones of the xsmi functions. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c0ac08f533
commit
0268b51e30
|
@ -149,7 +149,7 @@ static int orion_mdio_smi_read(struct mii_bus *bus, int mii_id,
|
||||||
|
|
||||||
ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
|
ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
return ret;
|
||||||
|
|
||||||
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
|
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
|
||||||
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
|
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
|
||||||
|
@ -158,18 +158,15 @@ static int orion_mdio_smi_read(struct mii_bus *bus, int mii_id,
|
||||||
|
|
||||||
ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
|
ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
return ret;
|
||||||
|
|
||||||
val = readl(dev->regs);
|
val = readl(dev->regs);
|
||||||
if (!(val & MVMDIO_SMI_READ_VALID)) {
|
if (!(val & MVMDIO_SMI_READ_VALID)) {
|
||||||
dev_err(bus->parent, "SMI bus read not valid\n");
|
dev_err(bus->parent, "SMI bus read not valid\n");
|
||||||
ret = -ENODEV;
|
return -ENODEV;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = val & GENMASK(15, 0);
|
return val & GENMASK(15, 0);
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
|
static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
|
||||||
|
@ -183,7 +180,7 @@ static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
|
||||||
|
|
||||||
ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
|
ret = orion_mdio_wait_ready(&orion_mdio_smi_ops, bus);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
return ret;
|
||||||
|
|
||||||
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
|
writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) |
|
||||||
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
|
(regnum << MVMDIO_SMI_PHY_REG_SHIFT) |
|
||||||
|
@ -191,8 +188,7 @@ static int orion_mdio_smi_write(struct mii_bus *bus, int mii_id,
|
||||||
(value << MVMDIO_SMI_DATA_SHIFT)),
|
(value << MVMDIO_SMI_DATA_SHIFT)),
|
||||||
dev->regs);
|
dev->regs);
|
||||||
|
|
||||||
out:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int orion_mdio_xsmi_is_done(struct orion_mdio_dev *dev)
|
static int orion_mdio_xsmi_is_done(struct orion_mdio_dev *dev)
|
||||||
|
|
Loading…
Reference in New Issue