[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <bccb77b9-7cdc-4965-aa05-05836466f81f@app.fastmail.com>
Date: Fri, 18 Jul 2025 11:53:05 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Daniel Lezcano" <daniel.lezcano@...aro.org>,
"Thomas Gleixner" <tglx@...utronix.de>,
"William McVicker" <willmcvicker@...gle.com>
Cc: linux-kernel@...r.kernel.org, "Krzysztof Kozlowski" <krzk@...nel.org>,
"Alim Akhtar" <alim.akhtar@...sung.com>,
"moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES" <linux-arm-kernel@...ts.infradead.org>,
"open list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES" <linux-samsung-soc@...r.kernel.org>
Subject: Re: [PATCH] clocksource/drivers/exynos_mct: Fix section mismatch from the
module conversion
On Tue, Jul 15, 2025, at 14:18, Daniel Lezcano wrote:
> 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
Powered by blists - more mailing lists