The driver does not support unbinding (e.g. as clockevents cannot be
deregistered) so suppress the bind attributes to prevent the driver from
being unbound and rebound after registration (and disabling the timer
when reprobing fails).
Even if the driver can currently only be built-in, also switch to
builtin_platform_driver() to prevent it from being unloaded should
modular builds ever be enabled.
Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/clocksource/timer-nxp-pit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-nxp-pit.c b/drivers/clocksource/timer-nxp-pit.c
index 2d0a3554b6bf..d1740f18f718 100644
--- a/drivers/clocksource/timer-nxp-pit.c
+++ b/drivers/clocksource/timer-nxp-pit.c
@@ -374,9 +374,10 @@ static struct platform_driver nxp_pit_driver = {
.driver = {
.name = "nxp-pit",
.of_match_table = pit_timer_of_match,
+ .suppress_bind_attrs = true,
},
.probe = pit_timer_probe,
};
-module_platform_driver(nxp_pit_driver);
+builtin_platform_driver(nxp_pit_driver);
TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init);
--
2.51.0
On 11/11/25 16:32, Johan Hovold wrote:
> The driver does not support unbinding (e.g. as clockevents cannot be
> deregistered) so suppress the bind attributes to prevent the driver from
> being unbound and rebound after registration (and disabling the timer
> when reprobing fails).
>
> Even if the driver can currently only be built-in, also switch to
> builtin_platform_driver() to prevent it from being unloaded should
> modular builds ever be enabled.
>
> Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/clocksource/timer-nxp-pit.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/timer-nxp-pit.c b/drivers/clocksource/timer-nxp-pit.c
> index 2d0a3554b6bf..d1740f18f718 100644
> --- a/drivers/clocksource/timer-nxp-pit.c
> +++ b/drivers/clocksource/timer-nxp-pit.c
> @@ -374,9 +374,10 @@ static struct platform_driver nxp_pit_driver = {
> .driver = {
> .name = "nxp-pit",
> .of_match_table = pit_timer_of_match,
> + .suppress_bind_attrs = true,
> },
> .probe = pit_timer_probe,
> };
> -module_platform_driver(nxp_pit_driver);
> +builtin_platform_driver(nxp_pit_driver);
Do not use builtin_platform here. You can add the tristate Kconfig
option for this driver, I tested it.
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
On Wed, Nov 12, 2025 at 11:00:05AM +0100, Daniel Lezcano wrote:
> On 11/11/25 16:32, Johan Hovold wrote:
> > The driver does not support unbinding (e.g. as clockevents cannot be
> > deregistered) so suppress the bind attributes to prevent the driver from
> > being unbound and rebound after registration (and disabling the timer
> > when reprobing fails).
> >
> > Even if the driver can currently only be built-in, also switch to
> > builtin_platform_driver() to prevent it from being unloaded should
> > modular builds ever be enabled.
> >
> > Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> > drivers/clocksource/timer-nxp-pit.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/clocksource/timer-nxp-pit.c b/drivers/clocksource/timer-nxp-pit.c
> > index 2d0a3554b6bf..d1740f18f718 100644
> > --- a/drivers/clocksource/timer-nxp-pit.c
> > +++ b/drivers/clocksource/timer-nxp-pit.c
> > @@ -374,9 +374,10 @@ static struct platform_driver nxp_pit_driver = {
> > .driver = {
> > .name = "nxp-pit",
> > .of_match_table = pit_timer_of_match,
> > + .suppress_bind_attrs = true,
> > },
> > .probe = pit_timer_probe,
> > };
> > -module_platform_driver(nxp_pit_driver);
> > +builtin_platform_driver(nxp_pit_driver);
>
> Do not use builtin_platform here. You can add the tristate Kconfig
> option for this driver, I tested it.
As I just commented on the cover letter, that's not relevant here;
builtin_platform_driver() only prevents unloading a driver built as a
module (which is something we want to prevent for these drivers).
Johan
On 11/12/25 12:01, Johan Hovold wrote:
> On Wed, Nov 12, 2025 at 11:00:05AM +0100, Daniel Lezcano wrote:
>> On 11/11/25 16:32, Johan Hovold wrote:
>>> The driver does not support unbinding (e.g. as clockevents cannot be
>>> deregistered) so suppress the bind attributes to prevent the driver from
>>> being unbound and rebound after registration (and disabling the timer
>>> when reprobing fails).
>>>
>>> Even if the driver can currently only be built-in, also switch to
>>> builtin_platform_driver() to prevent it from being unloaded should
>>> modular builds ever be enabled.
>>>
>>> Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")
>>> Signed-off-by: Johan Hovold <johan@kernel.org>
>>> ---
>>> drivers/clocksource/timer-nxp-pit.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/clocksource/timer-nxp-pit.c b/drivers/clocksource/timer-nxp-pit.c
>>> index 2d0a3554b6bf..d1740f18f718 100644
>>> --- a/drivers/clocksource/timer-nxp-pit.c
>>> +++ b/drivers/clocksource/timer-nxp-pit.c
>>> @@ -374,9 +374,10 @@ static struct platform_driver nxp_pit_driver = {
>>> .driver = {
>>> .name = "nxp-pit",
>>> .of_match_table = pit_timer_of_match,
>>> + .suppress_bind_attrs = true,
>>> },
>>> .probe = pit_timer_probe,
>>> };
>>> -module_platform_driver(nxp_pit_driver);
>>> +builtin_platform_driver(nxp_pit_driver);
>>
>> Do not use builtin_platform here. You can add the tristate Kconfig
>> option for this driver, I tested it.
>
> As I just commented on the cover letter, that's not relevant here;
> builtin_platform_driver() only prevents unloading a driver built as a
> module (which is something we want to prevent for these drivers).
I see your point, I agree. That is something we want to prevent for
drivers having a clockevent.
Even if the core framework will prevent the module to be unloaded, we
can consider these changes an additional guard.
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
The following commit has been merged into the timers/clocksource branch of tip:
Commit-ID: e25f964cf414dafa6bee5c9c2c0b1d1fb041dc92
Gitweb: https://git.kernel.org/tip/e25f964cf414dafa6bee5c9c2c0b1d1fb041dc92
Author: Johan Hovold <johan@kernel.org>
AuthorDate: Tue, 11 Nov 2025 16:32:25 +01:00
Committer: Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Wed, 26 Nov 2025 11:24:57 +01:00
clocksource/drivers/nxp-pit: Prevent driver unbind
The driver does not support unbinding (e.g. as clockevents cannot be
deregistered) so suppress the bind attributes to prevent the driver from
being unbound and rebound after registration (and disabling the timer
when reprobing fails).
Even if the driver can currently only be built-in, also switch to
builtin_platform_driver() to prevent it from being unloaded should
modular builds ever be enabled.
Fixes: bee33f22d7c3 ("clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/20251111153226.579-3-johan@kernel.org
---
drivers/clocksource/timer-nxp-pit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/timer-nxp-pit.c b/drivers/clocksource/timer-nxp-pit.c
index 2d0a355..d1740f1 100644
--- a/drivers/clocksource/timer-nxp-pit.c
+++ b/drivers/clocksource/timer-nxp-pit.c
@@ -374,9 +374,10 @@ static struct platform_driver nxp_pit_driver = {
.driver = {
.name = "nxp-pit",
.of_match_table = pit_timer_of_match,
+ .suppress_bind_attrs = true,
},
.probe = pit_timer_probe,
};
-module_platform_driver(nxp_pit_driver);
+builtin_platform_driver(nxp_pit_driver);
TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init);
© 2016 - 2026 Red Hat, Inc.