summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/ti
diff options
context:
space:
mode:
authorGrygorii Strashko <grygorii.strashko@ti.com>2019-06-06 19:30:39 +0300
committerDavid S. Miller <davem@davemloft.net>2019-06-09 22:53:06 +0300
commit8a6389a515f406a89a1a69c267fbc712cdd9e8e9 (patch)
treefa2abb33f6d71abf0c890eef20b26b990ccd9e8e /drivers/net/ethernet/ti
parent12775af50549121ade8efbdcf3612b867188ea0b (diff)
downloadlinux-8a6389a515f406a89a1a69c267fbc712cdd9e8e9.tar.xz
net: ethernet: ti: cpts: use devm_get_clk_from_child
Use devm_get_clk_from_child() instead of devm_clk_get() and this way allow to group CPTS DT properties in sub-node for better code readability and maintenance. Roll-back to devm_clk_get() if devm_get_clk_from_child() fails for backward compatibility. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti')
-rw-r--r--drivers/net/ethernet/ti/cpts.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index e257018ada71..0e79f9743c19 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -572,9 +572,14 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs,
if (ret)
return ERR_PTR(ret);
- cpts->refclk = devm_clk_get(dev, "cpts");
+ cpts->refclk = devm_get_clk_from_child(dev, node, "cpts");
+ if (IS_ERR(cpts->refclk))
+ /* try get clk from dev node for compatibility */
+ cpts->refclk = devm_clk_get(dev, "cpts");
+
if (IS_ERR(cpts->refclk)) {
- dev_err(dev, "Failed to get cpts refclk\n");
+ dev_err(dev, "Failed to get cpts refclk %ld\n",
+ PTR_ERR(cpts->refclk));
return ERR_CAST(cpts->refclk);
}