Skip to contentSkip to conversation

clocksource/drivers/timer-of: mark timer_of_exit as __init

PATCH In review Arnd Bergmann 5 participants 9 messages Nov 6, 2017 – Nov 13, 2017 Clocksource, clockevent drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clocksource/drivers/timer-of: mark timer_of_exit as __init

The newly added function triggers a harmless Kbuild warning because of a missing annotation:

WARNING: vmlinux.o(.text+0x448098): Section mismatch in reference from the function timer_of_exit() to the function .init.text:timer_clk_exit() The function timer_of_exit() references
the function __init timer_clk_exit().
This is often because timer_of_exit lacks a __init
annotation or the annotation of timer_clk_exit is wrong.

The function is only called from other __init functions, so it can safely be marked as __init as well.

Fixes f48729a999ee ("clocksource/drivers/timer-of: Add timer_of_exit function")
---
 drivers/clocksource/timer-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-of.c +1 -1
index 7c64a5c1bfc1..e301fdb1286e 100644
@@ -177,7 +177,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)
 	return ret;
 }
 
-void timer_of_exit(struct timer_of *to)
+void __init timer_of_exit(struct timer_of *to)
 {
 	if (to->flags & TIMER_OF_IRQ)
 		timer_irq_exit(&to->of_irq);
Signature · 1 line
2.9.0
#1 lore raw
Quoted 11 lines · Arnd Bergmann

The newly added function triggers a harmless Kbuild warning because of a missing annotation:

WARNING: vmlinux.o(.text+0x448098): Section mismatch in reference from the function timer_of_exit() to the function .init.text:timer_clk_exit() The function timer_of_exit() references
the function __init timer_clk_exit().
This is often because timer_of_exit lacks a __init
annotation or the annotation of timer_clk_exit is wrong.

The function is only called from other __init functions, so it can safely be marked as __init as well.

Hmm. I don't see any caller at all. From the intention of the patch I assume this isn't designed for using from init functions, so we rather have to remove the __init annotations from the called functions.

Sudeep posted a patch which does that:

https://lkml.kernel.org/r/[email protected]

Though I rather would know whether this function is going to be used at all and what the intention of this patch was.

Benjamin????

Thanks,

tglx

#2 lore raw
Quoted 17 lines · Thomas Gleixner
Quoted 11 lines · Arnd Bergmann

The newly added function triggers a harmless Kbuild warning because of a missing annotation:

WARNING: vmlinux.o(.text+0x448098): Section mismatch in reference from the function timer_of_exit() to the function .init.text:timer_clk_exit() The function timer_of_exit() references
the function __init timer_clk_exit().
This is often because timer_of_exit lacks a __init
annotation or the annotation of timer_clk_exit is wrong.

The function is only called from other __init functions, so it can safely be marked as __init as well.

Hmm. I don't see any caller at all. From the intention of the patch I assume this isn't designed for using from init functions, so we rather have to remove the __init annotations from the called functions.

Quoted 8 lines

Sudeep posted a patch which does that:

https://lkml.kernel.org/r/[email protected]

Though I rather would know whether this function is going to be used at all and what the intention of this patch was.

Benjamin????

My interpretation was that timer drivers are still supposed to be unregistered at module unload time, but that you might use the new timer_of_exit() in the failure path of whatever function calls timer_of_init() successfully when something fails in the next step.

Sudeep's interpretation also makes sense, I had not thought of that, but I now found the patch that adds a user in an init function:
https://www.mail-archive.com/[email protected]/msg1519644.html

It seems I guessed right and Sudeep guessed wrong (both by pure chance I admit). Both patches solve the problem, Sudeep's version is a little more robust in case we ever add a caller in an __exit function (which I think is currently not allowed), while mine saves a little bit of memory and matches the current usage better.

Arnd

#3 lore raw
Quoted 36 lines · Arnd Bergmann
Quoted 17 lines · Thomas Gleixner
Quoted 11 lines · Arnd Bergmann

The newly added function triggers a harmless Kbuild warning because of a missing annotation:

WARNING: vmlinux.o(.text+0x448098): Section mismatch in reference from the function timer_of_exit() to the function .init.text:timer_clk_exit() The function timer_of_exit() references
the function __init timer_clk_exit().
This is often because timer_of_exit lacks a __init
annotation or the annotation of timer_clk_exit is wrong.

The function is only called from other __init functions, so it can safely be marked as __init as well.

Hmm. I don't see any caller at all. From the intention of the patch I assume this isn't designed for using from init functions, so we rather have to remove the __init annotations from the called functions.

Quoted 8 lines

Sudeep posted a patch which does that:

https://lkml.kernel.org/r/[email protected]

Though I rather would know whether this function is going to be used at all and what the intention of this patch was.

Benjamin????

My interpretation was that timer drivers are still supposed to be unregistered at module unload time, but that you might use the new timer_of_exit() in the failure path of whatever function calls timer_of_init() successfully when something fails in the next step.

Sudeep's interpretation also makes sense, I had not thought of that, but I now found the patch that adds a user in an init function:
https://www.mail-archive.com/[email protected]/msg1519644.html

Quoted 5 lines

It seems I guessed right and Sudeep guessed wrong (both by pure chance I admit). Both patches solve the problem, Sudeep's version is a little more robust in case we ever add a caller in an __exit function (which I think is currently not allowed), while mine saves a little bit of memory and matches the current usage better.

Right, but if the only use case is the cleanup in an error path, then the function name is a misnomer.

Thanks,

tglx

#4 lore raw

2017-11-12 23:27 GMT+01:00 Thomas Gleixner <[email protected]>:

Quoted 43 lines · Arnd Bergmann
Quoted 36 lines · Thomas Gleixner
Quoted 17 lines · Arnd Bergmann
Quoted 11 lines

The newly added function triggers a harmless Kbuild warning because of a missing annotation:

WARNING: vmlinux.o(.text+0x448098): Section mismatch in reference from the function timer_of_exit() to the function .init.text:timer_clk_exit() The function timer_of_exit() references
the function __init timer_clk_exit().
This is often because timer_of_exit lacks a __init
annotation or the annotation of timer_clk_exit is wrong.

The function is only called from other __init functions, so it can safely be marked as __init as well.

Hmm. I don't see any caller at all. From the intention of the patch I assume this isn't designed for using from init functions, so we rather have to remove the __init annotations from the called functions.

Quoted 8 lines

Sudeep posted a patch which does that:

https://lkml.kernel.org/r/[email protected]

Though I rather would know whether this function is going to be used at all and what the intention of this patch was.

Benjamin????

My interpretation was that timer drivers are still supposed to be unregistered at module unload time, but that you might use the new timer_of_exit() in the failure path of whatever function calls timer_of_init() successfully when something fails in the next step.

Sudeep's interpretation also makes sense, I had not thought of that, but I now found the patch that adds a user in an init function:
https://www.mail-archive.com/[email protected]/msg1519644.html

Quoted 5 lines

It seems I guessed right and Sudeep guessed wrong (both by pure chance I admit). Both patches solve the problem, Sudeep's version is a little more robust in case we ever add a caller in an __exit function (which I think is currently not allowed), while mine saves a little bit of memory and matches the current usage better.

Quoted 6 lines

Right, but if the only use case is the cleanup in an error path, then the function name is a misnomer.

Thanks,

tglx

The function is suppose to be called when you need to undo what have been done in timer_of_init(). That could happen in error case or when removing the module.

Until now this function isn't called yet because it was part on my series to update stm32 timer and onky this patch has been merged.

Benjamin

#5 lore raw
In reply to Arnd Bergmann
Quoted 32 lines · Arnd Bergmann
Quoted 17 lines · Thomas Gleixner
Quoted 11 lines · Arnd Bergmann

The newly added function triggers a harmless Kbuild warning because of a missing annotation:

WARNING: vmlinux.o(.text+0x448098): Section mismatch in reference from the function timer_of_exit() to the function .init.text:timer_clk_exit() The function timer_of_exit() references
the function __init timer_clk_exit().
This is often because timer_of_exit lacks a __init
annotation or the annotation of timer_clk_exit is wrong.

The function is only called from other __init functions, so it can safely be marked as __init as well.

Hmm. I don't see any caller at all. From the intention of the patch I assume this isn't designed for using from init functions, so we rather have to remove the __init annotations from the called functions.

Quoted 8 lines

Sudeep posted a patch which does that:

https://lkml.kernel.org/r/[email protected]

Though I rather would know whether this function is going to be used at all and what the intention of this patch was.

Benjamin????

My interpretation was that timer drivers are still supposed to be unregistered at module unload time, but that you might use the new timer_of_exit() in the failure path of whatever function calls timer_of_init() successfully when something fails in the next step.

Quoted 6 lines

Sudeep's interpretation also makes sense, I had not thought of that, but I now found the patch that adds a user in an init function:
https://www.mail-archive.com/[email protected]/msg1519644.html

It seems I guessed right and Sudeep guessed wrong (both by pure chance I admit).

Ah OK, I just went by name that it will be called by some exit/remove function.

Quoted 5 lines

Both patches solve the problem, Sudeep's version is a little more robust in case we ever add a caller in an __exit function (which I think is currently not allowed), while mine saves a little bit of memory and matches the current usage better.

Agreed, may be if we add users which is called from init functions, the warning should disappear. Also as tglx suggested, we could rename if it's just used from init function error/exit paths.

--
Regards,
Sudeep

#6 lore raw
Quoted 49 lines · Sudeep Holla
Quoted 32 lines · Arnd Bergmann
Quoted 17 lines · Thomas Gleixner
Quoted 11 lines · Arnd Bergmann

The newly added function triggers a harmless Kbuild warning because of a missing annotation:

WARNING: vmlinux.o(.text+0x448098): Section mismatch in reference from the function timer_of_exit() to the function .init.text:timer_clk_exit() The function timer_of_exit() references
the function __init timer_clk_exit().
This is often because timer_of_exit lacks a __init
annotation or the annotation of timer_clk_exit is wrong.

The function is only called from other __init functions, so it can safely be marked as __init as well.

Hmm. I don't see any caller at all. From the intention of the patch I assume this isn't designed for using from init functions, so we rather have to remove the __init annotations from the called functions.

Quoted 8 lines

Sudeep posted a patch which does that:

https://lkml.kernel.org/r/[email protected]

Though I rather would know whether this function is going to be used at all and what the intention of this patch was.

Benjamin????

My interpretation was that timer drivers are still supposed to be unregistered at module unload time, but that you might use the new timer_of_exit() in the failure path of whatever function calls timer_of_init() successfully when something fails in the next step.

Quoted 6 lines

Sudeep's interpretation also makes sense, I had not thought of that, but I now found the patch that adds a user in an init function:
https://www.mail-archive.com/[email protected]/msg1519644.html

It seems I guessed right and Sudeep guessed wrong (both by pure chance I admit).

Ah OK, I just went by name that it will be called by some exit/remove function.

Quoted 5 lines

Both patches solve the problem, Sudeep's version is a little more robust in case we ever add a caller in an __exit function (which I think is currently not allowed), while mine saves a little bit of memory and matches the current usage better.

Quoted 3 lines

Agreed, may be if we add users which is called from init functions, the warning should disappear. Also as tglx suggested, we could rename if it's just used from init function error/exit paths.

The drivers are not compiled as module AFAICT, the function will be called in the init error path.

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#7 lore raw
Quoted 7 lines · Daniel Lezcano
Quoted 3 lines · Sudeep Holla

Agreed, may be if we add users which is called from init functions, the warning should disappear. Also as tglx suggested, we could rename if it's just used from init function error/exit paths.

The drivers are not compiled as module AFAICT, the function will be called in the init error path.

Ok, if the consensus is that this is used for common cleanup in __init error handling, then please can someone submit a new version of this which renames the function to something like timer_of_cleanup() and add the __init annotation to it? And while at it please add a kernel doc comment to that effect.

Thanks,

tglx

#8 lore raw
In reply to Daniel Lezcano
Quoted 1 line · Daniel Lezcano

On 13/11/2017 11:11, Sudeep Holla wrote:

[..]

Quoted 8 lines
Quoted 4 lines

Agreed, may be if we add users which is called from init functions, the warning should disappear. Also as tglx suggested, we could rename if it's just used from init function error/exit paths.

The drivers are not compiled as module AFAICT, the function will be called in the init error path.

Understood, IMO better to rename the functions as cleanup or something similar. exit made it sound differently and since there were no users, I assumed it to be used in remove/exit functions. Sorry for the noise.

Signature · 2 lines
Regards,
Sudeep