summaryrefslogtreecommitdiff
path: root/drivers/net/mdio/mdio-mux-meson-g12a.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2023-01-26 23:39:16 +0300
committerDavid S. Miller <davem@davemloft.net>2023-01-30 10:17:30 +0300
commit453d9fdc364b87601df168c962e93407fbe5e91a (patch)
tree61c054fa64748aefbd65093c779d60f87b60e931 /drivers/net/mdio/mdio-mux-meson-g12a.c
parent70eb3911d80f548a76fb9a40c8a3fd93ac061a42 (diff)
downloadlinux-453d9fdc364b87601df168c962e93407fbe5e91a.tar.xz
net: mdio: mux-meson-g12a: use __clk_is_enabled to simplify the code
By using __clk_is_enabled () we can avoid defining an own variable for tracking whether enable counter is zero. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mdio/mdio-mux-meson-g12a.c')
-rw-r--r--drivers/net/mdio/mdio-mux-meson-g12a.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/net/mdio/mdio-mux-meson-g12a.c b/drivers/net/mdio/mdio-mux-meson-g12a.c
index f0b554df62a9..910e5cf74e89 100644
--- a/drivers/net/mdio/mdio-mux-meson-g12a.c
+++ b/drivers/net/mdio/mdio-mux-meson-g12a.c
@@ -53,7 +53,6 @@
#define MESON_G12A_MDIO_INTERNAL_ID 1
struct g12a_mdio_mux {
- bool pll_is_enabled;
void __iomem *regs;
void *mux_handle;
struct clk *pll;
@@ -154,14 +153,12 @@ static int g12a_enable_internal_mdio(struct g12a_mdio_mux *priv)
int ret;
/* Enable the phy clock */
- if (!priv->pll_is_enabled) {
+ if (!__clk_is_enabled(priv->pll)) {
ret = clk_prepare_enable(priv->pll);
if (ret)
return ret;
}
- priv->pll_is_enabled = true;
-
/* Initialize ephy control */
writel(EPHY_G12A_ID, priv->regs + ETH_PHY_CNTL0);
@@ -192,10 +189,8 @@ static int g12a_enable_external_mdio(struct g12a_mdio_mux *priv)
writel_relaxed(0x0, priv->regs + ETH_PHY_CNTL2);
/* Disable the phy clock if enabled */
- if (priv->pll_is_enabled) {
+ if (__clk_is_enabled(priv->pll))
clk_disable_unprepare(priv->pll);
- priv->pll_is_enabled = false;
- }
return 0;
}
@@ -347,7 +342,7 @@ static int g12a_mdio_mux_remove(struct platform_device *pdev)
mdio_mux_uninit(priv->mux_handle);
- if (priv->pll_is_enabled)
+ if (__clk_is_enabled(priv->pll))
clk_disable_unprepare(priv->pll);
return 0;