All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get()
@ 2018-06-25 16:04 ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2018-06-25 16:04 UTC (permalink / raw
  To: Russell King, Greg Kroah-Hartman
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski, Sekhar Nori,
	Kevin Hilman, David Lechner

From: Bartosz Golaszewski <bgolaszewski@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@ti.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: David Lechner <david@lechnology.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@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.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get()
@ 2018-06-25 16:04 ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2018-06-25 16:04 UTC (permalink / raw
  To: linux-arm-kernel

From: Bartosz Golaszewski <bgolaszewski@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@ti.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: David Lechner <david@lechnology.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@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.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get()
  2018-06-25 16:04 ` Bartosz Golaszewski
@ 2018-06-25 23:02   ` David Lechner
  -1 siblings, 0 replies; 6+ messages in thread
From: David Lechner @ 2018-06-25 23:02 UTC (permalink / raw
  To: Bartosz Golaszewski, Russell King, Greg Kroah-Hartman
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski, Sekhar Nori,
	Kevin Hilman

On 06/25/2018 11:04 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@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@ti.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: David Lechner <david@lechnology.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---

Reviewed-by: David Lechner <david@lechnology.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get()
@ 2018-06-25 23:02   ` David Lechner
  0 siblings, 0 replies; 6+ messages in thread
From: David Lechner @ 2018-06-25 23:02 UTC (permalink / raw
  To: linux-arm-kernel

On 06/25/2018 11:04 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@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@ti.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: David Lechner <david@lechnology.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---

Reviewed-by: David Lechner <david@lechnology.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get()
  2018-06-25 23:02   ` David Lechner
@ 2018-06-27 11:25     ` Sekhar Nori
  -1 siblings, 0 replies; 6+ messages in thread
From: Sekhar Nori @ 2018-06-27 11:25 UTC (permalink / raw
  To: David Lechner, Bartosz Golaszewski, Russell King,
	Greg Kroah-Hartman
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski, Kevin Hilman

On Tuesday 26 June 2018 04:32 AM, David Lechner wrote:
> On 06/25/2018 11:04 AM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@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@ti.com>
>> Cc: Kevin Hilman <khilman@baylibre.com>
>> Cc: David Lechner <david@lechnology.com>
>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> ---
> 
> Reviewed-by: David Lechner <david@lechnology.com>

I think Russell previously said that the patch looks good to him. So you
can probably just add it to his patch tracker.

http://www.arm.linux.org.uk/developer/patches/add.php

FWIW, you can also add:

Reviewed-by: Sekhar Nori <nsekhar@ti.com>

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get()
@ 2018-06-27 11:25     ` Sekhar Nori
  0 siblings, 0 replies; 6+ messages in thread
From: Sekhar Nori @ 2018-06-27 11:25 UTC (permalink / raw
  To: linux-arm-kernel

On Tuesday 26 June 2018 04:32 AM, David Lechner wrote:
> On 06/25/2018 11:04 AM, Bartosz Golaszewski wrote:
>> From: Bartosz Golaszewski <bgolaszewski@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@ti.com>
>> Cc: Kevin Hilman <khilman@baylibre.com>
>> Cc: David Lechner <david@lechnology.com>
>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> ---
> 
> Reviewed-by: David Lechner <david@lechnology.com>

I think Russell previously said that the patch looks good to him. So you
can probably just add it to his patch tracker.

http://www.arm.linux.org.uk/developer/patches/add.php

FWIW, you can also add:

Reviewed-by: Sekhar Nori <nsekhar@ti.com>

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-06-27 11:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-25 16:04 [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get() Bartosz Golaszewski
2018-06-25 16:04 ` Bartosz Golaszewski
2018-06-25 23:02 ` David Lechner
2018-06-25 23:02   ` David Lechner
2018-06-27 11:25   ` Sekhar Nori
2018-06-27 11:25     ` Sekhar Nori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.