Commit 4228c3a2 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

net: phy: bcm7xxx: use devm_clk_get_optional_enabled to simplify the code

Use devm_clk_get_optional_enabled to simplify the code.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c6170d1
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
struct bcm7xxx_phy_priv { struct bcm7xxx_phy_priv {
u64 *stats; u64 *stats;
struct clk *clk;
}; };
static int bcm7xxx_28nm_d0_afe_config_init(struct phy_device *phydev) static int bcm7xxx_28nm_d0_afe_config_init(struct phy_device *phydev)
...@@ -811,6 +810,7 @@ static void bcm7xxx_28nm_get_phy_stats(struct phy_device *phydev, ...@@ -811,6 +810,7 @@ static void bcm7xxx_28nm_get_phy_stats(struct phy_device *phydev,
static int bcm7xxx_28nm_probe(struct phy_device *phydev) static int bcm7xxx_28nm_probe(struct phy_device *phydev)
{ {
struct bcm7xxx_phy_priv *priv; struct bcm7xxx_phy_priv *priv;
struct clk *clk;
int ret = 0; int ret = 0;
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
...@@ -825,13 +825,9 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) ...@@ -825,13 +825,9 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
if (!priv->stats) if (!priv->stats)
return -ENOMEM; return -ENOMEM;
priv->clk = devm_clk_get_optional(&phydev->mdio.dev, NULL); clk = devm_clk_get_optional_enabled(&phydev->mdio.dev, NULL);
if (IS_ERR(priv->clk)) if (IS_ERR(clk))
return PTR_ERR(priv->clk); return PTR_ERR(clk);
ret = clk_prepare_enable(priv->clk);
if (ret)
return ret;
/* Dummy read to a register to workaround an issue upon reset where the /* Dummy read to a register to workaround an issue upon reset where the
* internal inverter may not allow the first MDIO transaction to pass * internal inverter may not allow the first MDIO transaction to pass
...@@ -844,13 +840,6 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) ...@@ -844,13 +840,6 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
return ret; return ret;
} }
static void bcm7xxx_28nm_remove(struct phy_device *phydev)
{
struct bcm7xxx_phy_priv *priv = phydev->priv;
clk_disable_unprepare(priv->clk);
}
#define BCM7XXX_28NM_GPHY(_oui, _name) \ #define BCM7XXX_28NM_GPHY(_oui, _name) \
{ \ { \
.phy_id = (_oui), \ .phy_id = (_oui), \
...@@ -866,7 +855,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev) ...@@ -866,7 +855,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev)
.get_strings = bcm_phy_get_strings, \ .get_strings = bcm_phy_get_strings, \
.get_stats = bcm7xxx_28nm_get_phy_stats, \ .get_stats = bcm7xxx_28nm_get_phy_stats, \
.probe = bcm7xxx_28nm_probe, \ .probe = bcm7xxx_28nm_probe, \
.remove = bcm7xxx_28nm_remove, \
} }
#define BCM7XXX_28NM_EPHY(_oui, _name) \ #define BCM7XXX_28NM_EPHY(_oui, _name) \
...@@ -882,7 +870,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev) ...@@ -882,7 +870,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev)
.get_strings = bcm_phy_get_strings, \ .get_strings = bcm_phy_get_strings, \
.get_stats = bcm7xxx_28nm_get_phy_stats, \ .get_stats = bcm7xxx_28nm_get_phy_stats, \
.probe = bcm7xxx_28nm_probe, \ .probe = bcm7xxx_28nm_probe, \
.remove = bcm7xxx_28nm_remove, \
.read_mmd = bcm7xxx_28nm_ephy_read_mmd, \ .read_mmd = bcm7xxx_28nm_ephy_read_mmd, \
.write_mmd = bcm7xxx_28nm_ephy_write_mmd, \ .write_mmd = bcm7xxx_28nm_ephy_write_mmd, \
} }
...@@ -908,7 +895,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev) ...@@ -908,7 +895,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev)
/* PHY_BASIC_FEATURES */ \ /* PHY_BASIC_FEATURES */ \
.flags = PHY_IS_INTERNAL, \ .flags = PHY_IS_INTERNAL, \
.probe = bcm7xxx_28nm_probe, \ .probe = bcm7xxx_28nm_probe, \
.remove = bcm7xxx_28nm_remove, \
.config_init = bcm7xxx_16nm_ephy_config_init, \ .config_init = bcm7xxx_16nm_ephy_config_init, \
.config_aneg = genphy_config_aneg, \ .config_aneg = genphy_config_aneg, \
.read_status = genphy_read_status, \ .read_status = genphy_read_status, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment