From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
To: daniel.lezcano@oss.qualcomm.com, gregkh@linuxfoundation.org,
tglx@kernel.org
Cc: linux-kernel@vger.kernel.org, "Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
"Rob Herring" <robh@kernel.org>
Subject: [RFC PATCH 0/1] Timer module support pre-requisite
Date: Wed, 6 May 2026 15:52:41 +0200 [thread overview]
Message-ID: <20260506135242.4191560-1-daniel.lezcano@oss.qualcomm.com> (raw)
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
next reply other threads:[~2026-05-06 13:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 13:52 Daniel Lezcano [this message]
2026-05-06 13:52 ` [RFC PATCH 1/1] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260506135242.4191560-1-daniel.lezcano@oss.qualcomm.com \
--to=daniel.lezcano@oss.qualcomm.com \
--cc=bryan.odonoghue@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox