Skip to content

Commit

Permalink
net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref …
Browse files Browse the repository at this point in the history
…clock

While the external clock input will most likely be enabled, it's not
guaranteed and clk_get_rate in some suppliers will even just return
valid results when the clock is running.

So use devm_clk_get_optional_enabled to retrieve and enable the clock
in one go.

Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20231201150131.326766-2-heiko@sntech.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Heiko Stuebner authored and Jakub Kicinski committed Dec 4, 2023
1 parent 8ad55b1 commit 9853294
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/phy/micrel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ static int kszphy_probe(struct phy_device *phydev)

kszphy_parse_led_mode(phydev);

clk = devm_clk_get(&phydev->mdio.dev, "rmii-ref");
clk = devm_clk_get_optional_enabled(&phydev->mdio.dev, "rmii-ref");
/* NOTE: clk may be NULL if building without CONFIG_HAVE_CLK */
if (!IS_ERR_OR_NULL(clk)) {
unsigned long rate = clk_get_rate(clk);
Expand Down

0 comments on commit 9853294

Please sign in to comment.