diff options
author | Weihang Li <liweihang@huawei.com> | 2021-06-16 18:01:26 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-16 12:34:07 -0700 |
commit | 16d4d650966d9a607b32ceb709248f7833d88ed0 (patch) | |
tree | 193e30a0398dd4a9170a5af2f9ffd5c1ace67e79 | |
parent | 33ab463220e59a74e803e4fc1c589c28b241b0ab (diff) | |
download | linux-stable-16d4d650966d9a607b32ceb709248f7833d88ed0.tar.gz linux-stable-16d4d650966d9a607b32ceb709248f7833d88ed0.tar.bz2 linux-stable-16d4d650966d9a607b32ceb709248f7833d88ed0.zip |
net: phy: replace if-else statements with switch
Switch statement is clearer than a group of 'if-else'.
Signed-off-by: Weihang Li <liweihang@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/marvell.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 23751d95855b..3de93c9f2744 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -809,14 +809,19 @@ static int m88e1111_config_init_rgmii_delays(struct phy_device *phydev) { int delay; - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { + switch (phydev->interface) { + case PHY_INTERFACE_MODE_RGMII_ID: delay = MII_M1111_RGMII_RX_DELAY | MII_M1111_RGMII_TX_DELAY; - } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { + break; + case PHY_INTERFACE_MODE_RGMII_RXID: delay = MII_M1111_RGMII_RX_DELAY; - } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { + break; + case PHY_INTERFACE_MODE_RGMII_TXID: delay = MII_M1111_RGMII_TX_DELAY; - } else { + break; + default: delay = 0; + break; } return phy_modify(phydev, MII_M1111_PHY_EXT_CR, |