Skip to content

Commit 4228c3a

Browse files
hkallweitdavem330
authored andcommitted
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: Heiner Kallweit <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4c6170d commit 4228c3a

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

drivers/net/phy/bcm7xxx.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545

4646
struct bcm7xxx_phy_priv {
4747
u64 *stats;
48-
struct clk *clk;
4948
};
5049

5150
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,
811810
static int bcm7xxx_28nm_probe(struct phy_device *phydev)
812811
{
813812
struct bcm7xxx_phy_priv *priv;
813+
struct clk *clk;
814814
int ret = 0;
815815

816816
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL);
@@ -825,13 +825,9 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
825825
if (!priv->stats)
826826
return -ENOMEM;
827827

828-
priv->clk = devm_clk_get_optional(&phydev->mdio.dev, NULL);
829-
if (IS_ERR(priv->clk))
830-
return PTR_ERR(priv->clk);
831-
832-
ret = clk_prepare_enable(priv->clk);
833-
if (ret)
834-
return ret;
828+
clk = devm_clk_get_optional_enabled(&phydev->mdio.dev, NULL);
829+
if (IS_ERR(clk))
830+
return PTR_ERR(clk);
835831

836832
/* Dummy read to a register to workaround an issue upon reset where the
837833
* internal inverter may not allow the first MDIO transaction to pass
@@ -844,13 +840,6 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev)
844840
return ret;
845841
}
846842

847-
static void bcm7xxx_28nm_remove(struct phy_device *phydev)
848-
{
849-
struct bcm7xxx_phy_priv *priv = phydev->priv;
850-
851-
clk_disable_unprepare(priv->clk);
852-
}
853-
854843
#define BCM7XXX_28NM_GPHY(_oui, _name) \
855844
{ \
856845
.phy_id = (_oui), \
@@ -866,7 +855,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev)
866855
.get_strings = bcm_phy_get_strings, \
867856
.get_stats = bcm7xxx_28nm_get_phy_stats, \
868857
.probe = bcm7xxx_28nm_probe, \
869-
.remove = bcm7xxx_28nm_remove, \
870858
}
871859

872860
#define BCM7XXX_28NM_EPHY(_oui, _name) \
@@ -882,7 +870,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev)
882870
.get_strings = bcm_phy_get_strings, \
883871
.get_stats = bcm7xxx_28nm_get_phy_stats, \
884872
.probe = bcm7xxx_28nm_probe, \
885-
.remove = bcm7xxx_28nm_remove, \
886873
.read_mmd = bcm7xxx_28nm_ephy_read_mmd, \
887874
.write_mmd = bcm7xxx_28nm_ephy_write_mmd, \
888875
}
@@ -908,7 +895,6 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev)
908895
/* PHY_BASIC_FEATURES */ \
909896
.flags = PHY_IS_INTERNAL, \
910897
.probe = bcm7xxx_28nm_probe, \
911-
.remove = bcm7xxx_28nm_remove, \
912898
.config_init = bcm7xxx_16nm_ephy_config_init, \
913899
.config_aneg = genphy_config_aneg, \
914900
.read_status = genphy_read_status, \

0 commit comments

Comments
 (0)