From 76672e2e5b86d330e236eabe3ca3d471a581df57 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 19 Jun 2018 15:32:05 +0100 Subject: ARM: 8776/1: clkdev: Remove duplicated negative index check from __of_clk_get() __of_clk_get() calls of_parse_phandle_with_args(), which rejects negative indices since commit bd69f73f2c81eed9 ("of: Create function for counting number of phandles in a property"). Signed-off-by: Geert Uytterhoeven Reviewed-by: Stephen Boyd Signed-off-by: Russell King --- drivers/clk/clkdev.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/clk') diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 7513411140b6..02fcee2012e0 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -35,9 +35,6 @@ static struct clk *__of_clk_get(struct device_node *np, int index, struct clk *clk; int rc; - if (index < 0) - return ERR_PTR(-EINVAL); - rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index, &clkspec); if (rc) -- cgit v1.2.3 From 53ccb22b8d4a9293cf4249f3b526892810038fd3 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Thu, 28 Jun 2018 15:42:20 +0100 Subject: ARM: 8778/1: clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get() 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 Cc: Kevin Hilman Cc: David Lechner Reviewed-by: David Lechner Reviewed-by: Sekhar Nori Signed-off-by: Bartosz Golaszewski Signed-off-by: Russell King --- drivers/clk/clkdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/clk') diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 02fcee2012e0..9ab3db8b3988 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -196,7 +196,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; -- cgit v1.2.3