Thread (18 messages) 18 messages, 5 authors, 2025-08-26

Re: [PATCH] clocksource/drivers/exynos_mct: Fix section mismatch from the module conversion

From: "Arnd Bergmann" <arnd@arndb.de>
Date: 2025-07-18 09:53:27
Also in: linux-samsung-soc, lkml

On Tue, Jul 15, 2025, at 14:18, Daniel Lezcano wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 5075ebe052a7..80d263ee046d 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -657,7 +657,7 @@ static int exynos4_timer_interrupts(struct device_node *np,
 	return err;
 }

-static int mct_init_dt(struct device_node *np, unsigned int int_type)
+static __init_or_module int mct_init_dt(struct device_node *np, 
unsigned int int_type)
 {
 	bool frc_shared = of_property_read_bool(np, "samsung,frc-shared");
 	u32 local_idx[MCT_NR_LOCAL] = {0};
Something still feels off here, though I'm not sure what the best
solution would be. Some observations:

 - The exynos4_mct_probe() function is listed as permanent, but
   it indirectly calls an __init_or_module function, which is not
   technically allowed but does not produce a warning here
   because of the indirection.

 - if the driver is built-in and the platform_driver picks
   up the device, it can be manually unbound and rebound, but the
   mct_init_dt() will be discarded at this point.

 - In a loadable module, you cannot call register_current_timer_delay(),
   since this causes a link failure.

 - unloading the module fails to undo the registration, so the
   next call to delay(), sched_clock(), ktime_get() or an interrupt
   ends up in invalid memory.

I think the driver should use an explicit init function calling
platform_driver_probe(), so the probe is only done at initcall
time and both unbinding and unloading are prevented.

       Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help