Skip to content

Commit 453d9fd

Browse files
hkallweitdavem330
authored andcommitted
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>
1 parent 70eb391 commit 453d9fd

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/net/mdio/mdio-mux-meson-g12a.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
#define MESON_G12A_MDIO_INTERNAL_ID 1
5454

5555
struct g12a_mdio_mux {
56-
bool pll_is_enabled;
5756
void __iomem *regs;
5857
void *mux_handle;
5958
struct clk *pll;
@@ -154,14 +153,12 @@ static int g12a_enable_internal_mdio(struct g12a_mdio_mux *priv)
154153
int ret;
155154

156155
/* Enable the phy clock */
157-
if (!priv->pll_is_enabled) {
156+
if (!__clk_is_enabled(priv->pll)) {
158157
ret = clk_prepare_enable(priv->pll);
159158
if (ret)
160159
return ret;
161160
}
162161

163-
priv->pll_is_enabled = true;
164-
165162
/* Initialize ephy control */
166163
writel(EPHY_G12A_ID, priv->regs + ETH_PHY_CNTL0);
167164

@@ -192,10 +189,8 @@ static int g12a_enable_external_mdio(struct g12a_mdio_mux *priv)
192189
writel_relaxed(0x0, priv->regs + ETH_PHY_CNTL2);
193190

194191
/* Disable the phy clock if enabled */
195-
if (priv->pll_is_enabled) {
192+
if (__clk_is_enabled(priv->pll))
196193
clk_disable_unprepare(priv->pll);
197-
priv->pll_is_enabled = false;
198-
}
199194

200195
return 0;
201196
}
@@ -347,7 +342,7 @@ static int g12a_mdio_mux_remove(struct platform_device *pdev)
347342

348343
mdio_mux_uninit(priv->mux_handle);
349344

350-
if (priv->pll_is_enabled)
345+
if (__clk_is_enabled(priv->pll))
351346
clk_disable_unprepare(priv->pll);
352347

353348
return 0;

0 commit comments

Comments
 (0)