public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] Timer module support pre-requisite
@ 2026-05-06 13:52 Daniel Lezcano
  2026-05-06 13:52 ` [RFC PATCH 1/1] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Lezcano @ 2026-05-06 13:52 UTC (permalink / raw)
  To: daniel.lezcano, gregkh, tglx
  Cc: linux-kernel, Hans de Goede, Ilpo Järvinen,
	Bryan O'Donoghue, Rob Herring

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(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-05-06 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 13:52 [RFC PATCH 0/1] Timer module support pre-requisite Daniel Lezcano
2026-05-06 13:52 ` [RFC PATCH 1/1] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox