From a7e892c78310261895c090867587bdf9bcbb695d Mon Sep 17 00:00:00 2001 From: William Wu Date: Wed, 4 Nov 2020 10:35:05 +0800 Subject: [PATCH] phy: rockchip: inno-combphy: remove redundant param_exped The function param_read() and param_exped() do the same thing, so this patch uses the more general param_read() instead of the param_exped(), and delete the param_exped() directly. Change-Id: Ic097069c28a717ff5f70ceaa36a22ea1bd26b76f Signed-off-by: William Wu --- .../phy/rockchip/phy-rockchip-inno-combphy.c | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-combphy.c b/drivers/phy/rockchip/phy-rockchip-inno-combphy.c index e29590b7d1d3..d534daead02b 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-combphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-combphy.c @@ -135,31 +135,13 @@ static inline int param_write(struct regmap *base, return regmap_write(base, reg->offset, val); } -static inline bool param_exped(void __iomem *base, - const struct combphy_reg *reg, - unsigned int value) -{ - int ret; - unsigned int tmp, orig; - unsigned int mask = GENMASK(reg->bitend, reg->bitstart); - - ret = regmap_read(base, reg->offset, &orig); - if (ret) - return false; - - tmp = (orig & mask) >> reg->bitstart; - - return tmp == value; -} - static ssize_t u3phy_mode_show(struct device *device, struct device_attribute *attr, char *buf) { struct rockchip_combphy_priv *priv = dev_get_drvdata(device); - if (param_exped(priv->usb_pcie_grf, - &priv->cfg->grfcfg.u3_port_num, 0)) + if (param_read(priv->usb_pcie_grf, &priv->cfg->grfcfg.u3_port_num, 0)) return sprintf(buf, "u2\n"); else return sprintf(buf, "u3\n"); @@ -172,8 +154,7 @@ static ssize_t u3phy_mode_store(struct device *device, struct rockchip_combphy_priv *priv = dev_get_drvdata(device); if (!strncmp(buf, "u3", 2) && - param_exped(priv->usb_pcie_grf, - &priv->cfg->grfcfg.u3_port_num, 0)) { + param_read(priv->usb_pcie_grf, &priv->cfg->grfcfg.u3_port_num, 0)) { /* * Enable USB 3.0 rx termination, need to select * pipe_l0_rxtermination from USB 3.0 controller. @@ -188,8 +169,8 @@ static ssize_t u3phy_mode_store(struct device *device, &priv->cfg->grfcfg.u3_port_disable, false); dev_info(priv->dev, "Set usb3.0 and usb2.0 mode successfully\n"); } else if (!strncmp(buf, "u2", 2) && - param_exped(priv->usb_pcie_grf, - &priv->cfg->grfcfg.u3_port_num, 1)) { + param_read(priv->usb_pcie_grf, + &priv->cfg->grfcfg.u3_port_num, 1)) { /* * Disable USB 3.0 rx termination, need to select * pipe_l0_rxtermination from grf and remove rx