[RESEND PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get()
Bartosz Golaszewski
brgl at bgdev.pl
Tue Apr 17 02:50:01 PDT 2018
From: Bartosz Golaszewski <bgolaszewski at baylibre.com>
The way this function is implemented caused some confusion when
converting the TI DaVinci platform to using the common clock framework.
Current kernel supports booting DaVinci boards both in device tree as
well as legacy, board-file mode. In the latter, we always end up
calling clk_get_sys() as of_node is NULL and __of_clk_get_by_name()
returns -ENOENT.
It was not obvious at first glance how clk_get(dev, NULL) will work in
board-file mode since we always call __of_clk_get_by_name(). Let's make
it clearer by checking if of_node is NULL and skipping right to
clk_get_sys().
Cc: Sekhar Nori <nsekhar at ti.com>
Cc: Kevin Hilman <khilman at baylibre.com>
Cc: David Lechner <david at lechnology.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski at baylibre.com>
---
drivers/clk/clkdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 7513411140b6..f394e8964909 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -199,7 +199,7 @@ struct clk *clk_get(struct device *dev, const char *con_id)
const char *dev_id = dev ? dev_name(dev) : NULL;
struct clk *clk;
- if (dev) {
+ if (dev && dev->of_node) {
clk = __of_clk_get_by_name(dev->of_node, dev_id, con_id);
if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER)
return clk;
--
2.17.0
More information about the linux-arm-kernel
mailing list