Skip to contentSkip to conversation

Improve CLKSRC_OF matching

PATCH In review Rob Herring 6 participants 19 messages Feb 7, 2013 – Feb 14, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Improve CLKSRC_OF matching

From: Rob Herring <[email protected]>

In the recently added support for OF based clocksource init, a device node will be matched twice. We can fix this by passing the device node to the init functions and removing the match functions within the init functions.

This is based on arm-soc for-next branch and commit "of: fix incorrect return value of of_find_matching_node_and_match()" in my DT for-next branch.

Rob

Rob Herring (4):
clocksource: pass DT node pointer to init functions
clocksource: bcm2835: use the device_node pointer passed to init
clocksource: vt8500: use the device_node pointer passed to init
clocksource: tegra20: use the device_node pointer passed to init

 drivers/clocksource/bcm2835_timer.c |   12 +-----
 drivers/clocksource/clksrc-of.c     |    4 +-
 drivers/clocksource/tegra20_timer.c |   70 ++++++++++++++---------------------
 drivers/clocksource/vt8500_timer.c  |   14 +------
 4 files changed, 31 insertions(+), 69 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/4 clocksource: pass DT node pointer to init functions

From: Rob Herring <[email protected]>

In cases where we have multiple nodes of the same type, we may need the node pointer to know which node was matched. Passing the node pointer also keeps the init function from having to match the node a 2nd time.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/clksrc-of.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/clksrc-of.c +2 -2
index bdabdaa..3ef11fb 100644
@@ -26,10 +26,10 @@ void __init clocksource_of_init(void)
 {
 	struct device_node *np;
 	const struct of_device_id *match;
-	void (*init_func)(void);
+	void (*init_func)(struct device_node *);
 
 	for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
 		init_func = match->data;
-		init_func();
+		init_func(np);
 	}
 }
Signature · 1 line
1.7.10.4
Tested-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] clocksource: pass DT node pointer to init functions

2013/2/7 Rob Herring <[email protected]>:

Quoted 6 lines

From: Rob Herring <[email protected]>

In cases where we have multiple nodes of the same type, we may need the node pointer to know which node was matched. Passing the node pointer also keeps the init function from having to match the node a 2nd time.

Quoted 6 lines
Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/clksrc-of.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

The rest is just the same as I have done. Any option to add these patches to v3.9?
Because I need these patches for zynq timer because we have two in the soc. Is it OK to register several clock source and clockevent devices?

btw: there is still one issue because you can just setup only one compatibility string.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
#3 lore raw

Re: [PATCH 1/4] clocksource: pass DT node pointer to init functions

Quoted 14 lines · Michal Simek

2013/2/7 Rob Herring <[email protected]>:

Quoted 6 lines

From: Rob Herring <[email protected]>

In cases where we have multiple nodes of the same type, we may need the node pointer to know which node was matched. Passing the node pointer also keeps the init function from having to match the node a 2nd time.

Quoted 6 lines
Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/clksrc-of.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines

The rest is just the same as I have done. Any option to add these patches to v3.9?

I would like to before we have more users to fix, but it will have to be post rc1. If not, Arnd/Olof should be be able to provide a stable branch for 3.10.

Quoted 2 lines

Because I need these patches for zynq timer because we have two in the soc. Is it OK to register several clock source and clockevent devices?

If it is 1 DT node, then that should be fine.

Quoted 2 lines

btw: there is still one issue because you can just setup only one compatibility string.

You can have multiple CLOCKSOURCE_OF_DECLARE statements. The gic code does this for irqchips.

Rob

#4 lore raw

Re: [PATCH 1/4] clocksource: pass DT node pointer to init functions

2013/2/13 Rob Herring <[email protected]>:

Quoted 15 lines · Michal Simek
Quoted 14 lines

2013/2/7 Rob Herring <[email protected]>:

Quoted 12 lines

From: Rob Herring <[email protected]>

In cases where we have multiple nodes of the same type, we may need the node pointer to know which node was matched. Passing the node pointer also keeps the init function from having to match the node a 2nd time.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/clksrc-of.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 8 lines
Quoted 4 lines

The rest is just the same as I have done. Any option to add these patches to v3.9?

I would like to before we have more users to fix, but it will have to be post rc1. If not, Arnd/Olof should be be able to provide a stable branch for 3.10.

ok

Quoted 4 lines
Quoted 2 lines

Because I need these patches for zynq timer because we have two in the soc. Is it OK to register several clock source and clockevent devices?

If it is 1 DT node, then that should be fine.

zynq is using two triple timer counter IP . There are also described by two different DT nodes because there are separated and uses different baseaddresses.

Does it mean that if there are 2 DT nodes that it won't work?

One more thing. Is there any rule which should describe which timer should be used for clockevent and for clocksource?

Quoted 5 lines
Quoted 2 lines

btw: there is still one issue because you can just setup only one compatibility string.

You can have multiple CLOCKSOURCE_OF_DECLARE statements. The gic code does this for irqchips.

Ok. Will look at it.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
#5 lore raw

Re: [PATCH 1/4] clocksource: pass DT node pointer to init functions

Quoted 18 lines · Michal Simek

2013/2/13 Rob Herring <[email protected]>:

Quoted 17 lines · Michal Simek
Quoted 16 lines

2013/2/7 Rob Herring <[email protected]>:

Quoted 6 lines

From: Rob Herring <[email protected]>

In cases where we have multiple nodes of the same type, we may need the node pointer to know which node was matched. Passing the node pointer also keeps the init function from having to match the node a 2nd time.

Quoted 6 lines
Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/clksrc-of.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

The rest is just the same as I have done. Any option to add these patches to v3.9?

I would like to before we have more users to fix, but it will have to be post rc1. If not, Arnd/Olof should be be able to provide a stable branch for 3.10.

ok

I now see you were trying to get zynq changes in for 3.9. You could add this patch to your pull request. As is, it is not dependent on some DT code changes, but the subsequent patches are. I can send the rest after rc1. It's a bit of a hack with the function call prototype, but nothing actually breaks. I was going to combine as Arnd suggested, but either way is probably fine.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Because I need these patches for zynq timer because we have two in the soc. Is it OK to register several clock source and clockevent devices?

If it is 1 DT node, then that should be fine.

Quoted 8 lines

zynq is using two triple timer counter IP . There are also described by two different DT nodes because there are separated and uses different baseaddresses.

Does it mean that if there are 2 DT nodes that it won't work?

One more thing. Is there any rule which should describe which timer should be used for clockevent and for clocksource?

No. This is a common problem. A simple solution is a "linux,clockevent" property, but I want to avoid that. Ultimately it is some feature of the h/w that makes you choose. This could be it has an interrupt or not, higher frequency, has timer compare pins, gets power gated, etc. So you should describe enough of the h/w properties to make this decision. OMAP is an example doing this with lots of timers with varying integration level differences.

Rob

Quoted 14 lines
Quoted 7 lines
Quoted 4 lines

btw: there is still one issue because you can just setup only one compatibility string.

You can have multiple CLOCKSOURCE_OF_DECLARE statements. The gic code does this for irqchips.

Ok. Will look at it.

Thanks,
Michal

#6 lore raw

Re: [PATCH 1/4] clocksource: pass DT node pointer to init functions

2013/2/14 Rob Herring <[email protected]>:

Quoted 26 lines · Michal Simek
Quoted 25 lines

2013/2/13 Rob Herring <[email protected]>:

Quoted 23 lines · Michal Simek
Quoted 14 lines

2013/2/7 Rob Herring <[email protected]>:

Quoted 6 lines

From: Rob Herring <[email protected]>

In cases where we have multiple nodes of the same type, we may need the node pointer to know which node was matched. Passing the node pointer also keeps the init function from having to match the node a 2nd time.

Quoted 6 lines
Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/clksrc-of.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 4 lines

The rest is just the same as I have done. Any option to add these patches to v3.9?

I would like to before we have more users to fix, but it will have to be post rc1. If not, Arnd/Olof should be be able to provide a stable branch for 3.10.

Quoted 8 lines
Quoted 1 line

ok

I now see you were trying to get zynq changes in for 3.9. You could add this patch to your pull request. As is, it is not dependent on some DT code changes, but the subsequent patches are. I can send the rest after rc1. It's a bit of a hack with the function call prototype, but nothing actually breaks. I was going to combine as Arnd suggested, but either way is probably fine.

It is not big deal with that. I just want to use this patch. No problem to keep it in my repo. I am not worried about. The main point for me is that the patch exists
and I can use it.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Because I need these patches for zynq timer because we have two in the soc. Is it OK to register several clock source and clockevent devices?

If it is 1 DT node, then that should be fine.

zynq is using two triple timer counter IP . There are also described by two different DT nodes because there are separated and uses different baseaddresses.

Quoted 8 lines
Quoted 5 lines

Does it mean that if there are 2 DT nodes that it won't work?

One more thing. Is there any rule which should describe which timer should be used for clockevent and for clocksource?

No. This is a common problem. A simple solution is a "linux,clockevent" property, but I want to avoid that.

Let me describe it a little bit more. I am going to change current mainline implementation
for zynq timer which uses special compatible string to define clocksource and clockevent
device. I don't think this is right way to go because compatible string shouldn't point
to device usage. Which is exact case you wanted to avoid.

Quoted 4 lines

Ultimately it is some feature of the
h/w that makes you choose. This could be it has an interrupt or not, higher frequency, has timer compare pins, gets power gated, etc. So you should describe enough of the h/w properties to make this decision.

For different timer type, kernel should decide which timer should be used. It should be easy to test
because I can add some timers to the programmable logic (as is done for Microblaze) and check
how kernel decide which clocksource/clockevent device will use. I believe there is any logic around.

For solution with two instances of the same triple timer counters it is impossible
to specify additional h/w property because all of 6 timers are the same. And also adding special parameter to IP goes against rule that device-tree should describe hw not Linux usage.
Maybe enough to save information to driver that clocksource and clockevent device is registered
and do not try to register another timer (and also another timer from another instance).

Or maybe it can be done via chosen property or via aliases property where timer0 alias is that one who should be used for clocksource and clockevent device.
(for my case alias to one instance of triple timer counter).

I saw some dtses which have aliases timer.

How good/bad is this option?

Quoted 3 lines

OMAP
is an example doing this with lots of timers with varying integration level differences.

Can you point me that that omap drivers you are talking about?

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
#7 lore raw

Re: [PATCH 1/4] clocksource: pass DT node pointer to init functions

Quoted 36 lines · Michal Simek

2013/2/14 Rob Herring <[email protected]>:

Quoted 8 lines · Michal Simek
Quoted 5 lines

2013/2/13 Rob Herring <[email protected]>:

Quoted 4 lines · Michal Simek
Quoted 3 lines

2013/2/7 Rob Herring <[email protected]>:

Quoted 2 lines

From: Rob Herring <[email protected]>

Quoted 5 lines
Quoted 2 lines

One more thing. Is there any rule which should describe which timer should be used for clockevent and for clocksource?

No. This is a common problem. A simple solution is a "linux,clockevent" property, but I want to avoid that.

Let me describe it a little bit more. I am going to change current mainline implementation
for zynq timer which uses special compatible string to define clocksource and clockevent
device. I don't think this is right way to go because compatible string shouldn't point
to device usage. Which is exact case you wanted to avoid.

Quoted 4 lines

Ultimately it is some feature of the
h/w that makes you choose. This could be it has an interrupt or not, higher frequency, has timer compare pins, gets power gated, etc. So you should describe enough of the h/w properties to make this decision.

For different timer type, kernel should decide which timer should be used. It should be easy to test
because I can add some timers to the programmable logic (as is done for Microblaze) and check
how kernel decide which clocksource/clockevent device will use. I believe there is any logic around.

Quoted 9 lines

For solution with two instances of the same triple timer counters it is impossible
to specify additional h/w property because all of 6 timers are the same. And also adding special parameter to IP goes against rule that device-tree should describe hw not Linux usage.
Maybe enough to save information to driver that clocksource and clockevent device is registered
and do not try to register another timer (and also another timer from another instance).

So if you don't care which one is used, then use the first one found and be done with it. You will have to make your init function just return on subsequent calls.

Quoted 9 lines

Or maybe it can be done via chosen property or via aliases property where timer0 alias is that one who should be used for clocksource and clockevent device.
(for my case alias to one instance of triple timer counter).

I saw some dtses which have aliases timer.

How good/bad is this option?

It's best if you can avoid aliases IMO.

Quoted 7 lines
Quoted 5 lines

OMAP
is an example doing this with lots of timers with varying integration level differences.

Can you point me that that omap drivers you are talking about?

arch/arm/mach-omap2/timer.c. They have properties such as always on and secure mode.

Rob

#8 lore raw

PATCH 2/4 clocksource: bcm2835: use the device_node pointer passed to init

In reply to Rob Herring

From: Rob Herring <[email protected]>

We've already matched the node, so use the node pointer passed in.

Cc Stephen Warren <[email protected]>
Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/bcm2835_timer.c |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/clocksource/bcm2835_timer.c +1 -11
index 50c68fe..766611d 100644
@@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id)
 	}
 }
 
-static struct of_device_id bcm2835_time_match[] __initconst = {
-	{ .compatible = "brcm,bcm2835-system-timer" },
-	{}
-};
-
-static void __init bcm2835_timer_init(void)
+static void __init bcm2835_timer_init(struct device_node *node)
 {
-	struct device_node *node;
 	void __iomem *base;
 	u32 freq;
 	int irq;
 	struct bcm2835_timer *timer;
 
-	node = of_find_matching_node(NULL, bcm2835_time_match);
-	if (!node)
-		panic("No bcm2835 timer node");
-
 	base = of_iomap(node, 0);
 	if (!base)
 		panic("Can't remap registers");
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH 3/4 clocksource: vt8500: use the device_node pointer passed to init

In reply to Rob Herring

From: Rob Herring <[email protected]>

We've already matched the node, so use the node pointer passed in.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/vt8500_timer.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/clocksource/vt8500_timer.c +1 -13
index 8efc86b..2422552 100644
@@ -129,22 +129,10 @@ static struct irqaction irq = {
 	.dev_id  = &clockevent,
 };
 
-static struct of_device_id vt8500_timer_ids[] = {
-	{ .compatible = "via,vt8500-timer" },
-	{ }
-};
-
-static void __init vt8500_timer_init(void)
+static void __init vt8500_timer_init(struct device_node *np)
 {
-	struct device_node *np;
 	int timer_irq;
 
-	np = of_find_matching_node(NULL, vt8500_timer_ids);
-	if (!np) {
-		pr_err("%s: Timer description missing from Device Tree\n",
-								__func__);
-		return;
-	}
 	regbase = of_iomap(np, 0);
 	if (!regbase) {
 		pr_err("%s: Missing iobase description in Device Tree\n",
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH 4/4 clocksource: tegra20: use the device_node pointer passed to init

In reply to Rob Herring

From: Rob Herring <[email protected]>

We've already matched the node, so use the node pointer passed in. The rtc init was intermingled with the timer init, so split this out to a separate init function.

Cc Stephen Warren <[email protected]>
Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>

---
Stephen,

It doesn't seem like there are any init ordering issues to me, but please test/comment.

Rob

 drivers/clocksource/tegra20_timer.c |   70 ++++++++++++++---------------------
 1 file changed, 27 insertions(+), 43 deletions(-)
drivers/clocksource/tegra20_timer.c +27 -43
index 0bde03f..15cc723 100644
@@ -154,29 +154,12 @@ static struct irqaction tegra_timer_irq = {
 	.dev_id		= &tegra_clockevent,
 };
 
-static const struct of_device_id timer_match[] __initconst = {
-	{ .compatible = "nvidia,tegra20-timer" },
-	{}
-};
-
-static const struct of_device_id rtc_match[] __initconst = {
-	{ .compatible = "nvidia,tegra20-rtc" },
-	{}
-};
-
-static void __init tegra20_init_timer(void)
+static void __init tegra20_init_timer(struct device_node *np)
 {
-	struct device_node *np;
 	struct clk *clk;
 	unsigned long rate;
 	int ret;
 
-	np = of_find_matching_node(NULL, timer_match);
-	if (!np) {
-		pr_err("Failed to find timer DT node\n");
-		BUG();
-	}
-
 	timer_reg_base = of_iomap(np, 0);
 	if (!timer_reg_base) {
 		pr_err("Can't map timer registers\n");
@@ -200,30 +183,6 @@ static void __init tegra20_init_timer(void)
 
 	of_node_put(np);
 
-	np = of_find_matching_node(NULL, rtc_match);
-	if (!np) {
-		pr_err("Failed to find RTC DT node\n");
-		BUG();
-	}
-
-	rtc_base = of_iomap(np, 0);
-	if (!rtc_base) {
-		pr_err("Can't map RTC registers");
-		BUG();
-	}
-
-	/*
-	 * rtc registers are used by read_persistent_clock, keep the rtc clock
-	 * enabled
-	 */
-	clk = clk_get_sys("rtc-tegra", NULL);
-	if (IS_ERR(clk))
-		pr_warn("Unable to get rtc-tegra clock\n");
-	else
-		clk_prepare_enable(clk);
-
-	of_node_put(np);
-
 	switch (rate) {
 	case 12000000:
 		timer_writel(0x000b, TIMERUS_USEC_CFG);
@@ -262,9 +221,34 @@ static void __init tegra20_init_timer(void)
 #ifdef CONFIG_HAVE_ARM_TWD
 	twd_local_timer_of_register();
 #endif
+}
+CLOCKSOURCE_OF_DECLARE(tegra20_timer, "nvidia,tegra20-timer", tegra20_init_timer);
+
+static void __init tegra20_init_rtc(struct device_node *np)
+{
+	struct clk *clk;
+
+	rtc_base = of_iomap(np, 0);
+	if (!rtc_base) {
+		pr_err("Can't map RTC registers");
+		BUG();
+	}
+
+	/*
+	 * rtc registers are used by read_persistent_clock, keep the rtc clock
+	 * enabled
+	 */
+	clk = clk_get_sys("rtc-tegra", NULL);
+	if (IS_ERR(clk))
+		pr_warn("Unable to get rtc-tegra clock\n");
+	else
+		clk_prepare_enable(clk);
+
+	of_node_put(np);
+
 	register_persistent_clock(NULL, tegra_read_persistent_clock);
 }
-CLOCKSOURCE_OF_DECLARE(tegra20, "nvidia,tegra20-timer", tegra20_init_timer);
+CLOCKSOURCE_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc);
 
 #ifdef CONFIG_PM
 static u32 usec_config;
Signature · 1 line
1.7.10.4
Reviewed-by Tested-by on v1 4/4
#12 lore raw

Re: [PATCH 4/4] clocksource: tegra20: use the device_node pointer passed to init

Quoted 5 lines · Rob Herring

From: Rob Herring <[email protected]>

We've already matched the node, so use the node pointer passed in. The rtc init was intermingled with the timer init, so split this out to a separate init function.

The series,

Patches 1,4:

One thing I wonder re: patch 4 - I know someone (I think Hiroshi, now CC'd) planned to refactor drivers/clocksource/tegra20_timer.c to enhance it for Tegra114. I'd like to check with him that the refactoring in this patch won't impede that at all.

#13 lore raw

Re: [PATCH 4/4] clocksource: tegra20: use the device_node pointer passed to init

Stephen Warren <[email protected]> wrote @ Thu, 7 Feb 2013 20:39:40 +0100:

Quoted 10 lines · Rob Herring
Quoted 5 lines

From: Rob Herring <[email protected]>

We've already matched the node, so use the node pointer passed in. The rtc init was intermingled with the timer init, so split this out to a separate init function.

The series,

Quoted 7 lines

Patches 1,4:

One thing I wonder re: patch 4 - I know someone (I think Hiroshi, now CC'd) planned to refactor drivers/clocksource/tegra20_timer.c to enhance it for Tegra114. I'd like to check with him that the refactoring in this patch won't impede that at all.

Actually this covers RTC part. I'll rework mine for the rest on the top of this.

Acked-by on the v1 series
#14 lore raw
In reply to Rob Herring
Quoted 10 lines · Rob Herring

From: Rob Herring <[email protected]>

In the recently added support for OF based clocksource init, a device node will be matched twice. We can fix this by passing the device node to the init functions and removing the match functions within the init functions.

This is based on arm-soc for-next branch and commit "of: fix incorrect return value of of_find_matching_node_and_match()" in my DT for-next branch.

Conceptually this is definitely the way to go, but I noticed that you create build warnings for the bisection points after the first patch. I would suggest actually merging the first three patches into one and also changing the prototype for the tegra function in that patch to avoid this.

Arnd

#15 lore raw
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Rob Herring

From: Rob Herring <[email protected]>

In the recently added support for OF based clocksource init, a device node will be matched twice. We can fix this by passing the device node to the init functions and removing the match functions within the init functions.

This is based on arm-soc for-next branch and commit "of: fix incorrect return value of of_find_matching_node_and_match()" in my DT for-next branch.

Quoted 8 lines

Conceptually this is definitely the way to go, but I noticed that you create build warnings for the bisection points after the first patch. I would suggest actually merging the first three patches into one and also changing the prototype for the tegra function in that patch to avoid this.

How so? I don't see a warning as there is no type checking on the init function since of_device_id.data is just a void *. It would be good to have type checking here if you know a way, but I don't. I agree it is a bit abusive and can change it as you suggest.

Rob

#16 lore raw
Quoted 3 lines · Rob Herring

How so? I don't see a warning as there is no type checking on the init function since of_device_id.data is just a void *. It would be good to have type checking here if you know a way, but I don't.

Ah, that's right. So it silently builds find even though the prototypes don't match, and given the C calling conventions it even ends up working correctly, it just feels wrong.

Arnd

Acked-by on the v1 series
#17 lore raw
In reply to Rob Herring
Quoted 18 lines · Rob Herring

From: Rob Herring <[email protected]>

In the recently added support for OF based clocksource init, a device node will be matched twice. We can fix this by passing the device node to the init functions and removing the match functions within the init functions.

This is based on arm-soc for-next branch and commit "of: fix incorrect return value of of_find_matching_node_and_match()" in my DT for-next branch.

Rob

Rob Herring (4):
clocksource: pass DT node pointer to init functions
clocksource: bcm2835: use the device_node pointer passed to init
clocksource: vt8500: use the device_node pointer passed to init
clocksource: tegra20: use the device_node pointer passed to init

Quoted 6 lines
 drivers/clocksource/bcm2835_timer.c |   12 +-----
 drivers/clocksource/clksrc-of.c     |    4 +-
 drivers/clocksource/tegra20_timer.c |   70 ++++++++++++++---------------------
 drivers/clocksource/vt8500_timer.c  |   14 +------
 4 files changed, 31 insertions(+), 69 deletions(-)

Looks fine, although I didn't get a CC for the vt8500 patch so I had to go hunting for it :)

For patches 1 & 3:

#18 lore raw
Quoted 26 lines · Tony Prisk
Quoted 18 lines · Rob Herring

From: Rob Herring <[email protected]>

In the recently added support for OF based clocksource init, a device node will be matched twice. We can fix this by passing the device node to the init functions and removing the match functions within the init functions.

This is based on arm-soc for-next branch and commit "of: fix incorrect return value of of_find_matching_node_and_match()" in my DT for-next branch.

Rob

Rob Herring (4):
clocksource: pass DT node pointer to init functions
clocksource: bcm2835: use the device_node pointer passed to init
clocksource: vt8500: use the device_node pointer passed to init
clocksource: tegra20: use the device_node pointer passed to init

Quoted 6 lines
 drivers/clocksource/bcm2835_timer.c |   12 +-----
 drivers/clocksource/clksrc-of.c     |    4 +-
 drivers/clocksource/tegra20_timer.c |   70 ++++++++++++++---------------------
 drivers/clocksource/vt8500_timer.c  |   14 +------
 4 files changed, 31 insertions(+), 69 deletions(-)
Quoted 2 lines

Looks fine, although I didn't get a CC for the vt8500 patch so I had to go hunting for it :)

Since it got moved to drivers/clocksource, did MAINTAINERS get updated? I just ran get_maintainers.pl.

Stephen also needs to add himself to Tegra as I had to add him manually.

Rob

Quoted 4 lines

For patches 1 & 3: