Skip to content

RFC Timer module support pre-requisite

Daniel Lezcano linux-arch lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1clocksource/drivers/timer-probe: Create a platform_device before the framework is initializeddrivers/clocksource/timer-probe.c include/asm-generic/vmlinux.lds.h include/linux/clocksource.h+93 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] Timer module support pre-requisite

Converting the timer driver modules requires a particular care because, depending on the platform, that may be not supported.

A previous study showed we are safe regarding how the module refcount is held and if THIS_MODULE is set for the clockevent and the clocksource when they are registered.

It won't be possible to unload a module if a clockevent is registered.

It will be possible to unload a module if only a clocksource is registered and it is not the current one.

However platforms without architected timers may need the timer driver to be initialized very early while others can be initialized later. The former can not be a module and the init function receives a device_node pointer, there is no device associated and devres is not used. That results in a lot of rollbacking code where usually it is where we find bug and resource leaks. The latter can be converted to a module and uses a module_platform_driver(), thus the init function is a probe function receiving a struct platform_device pointer parameter.

We end up with two approaches and duplicate code for the init functions. This is not optimal (and ugly).

Finally, we have the driver having to be initialized very early on some platforms and be built as a module on other platforms, resulting on having two init functions co-existing in the same driver.

The proposed change provides what is needed to move to the same probe function for early init, builtin and module timers.

Daniel Lezcano (1):
clocksource/drivers/timer-probe: Create a platform_device before the
framework is initialized

 drivers/clocksource/timer-probe.c | 63 ++++++++++++++++++++++++++++++-
 include/asm-generic/vmlinux.lds.h | 10 +++++
 include/linux/clocksource.h       | 21 +++++++++++
 3 files changed, 93 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0