Re: [PATCH RFC] timer: of: Create a platform_device before the framework is initialized
From: William McVicker
Date: Tue Jul 01 2025 - 14:22:06 EST
On 07/01/2025, Arnd Bergmann wrote:
> On Tue, Jul 1, 2025, at 01:53, William McVicker wrote:
> >> @@ -1550,6 +1553,8 @@ typedef void (*of_init_fn_1)(struct device_node *);
> >> _OF_DECLARE(table, name, compat, fn, of_init_fn_1_ret)
> >> #define OF_DECLARE_2(table, name, compat, fn) \
> >> _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
> >> +#define OF_DECLARE_PDEV(table, name, compat, fn) \
> >> + _OF_DECLARE(table, name, compat, fn, of_init_fn_pdev)
> >
> > To support auto-module loading you'll need to also define the
> > MODULE_DEVICE_TABLE() as part of TIMER_OF_DECLARE_PDEV().
> >
> > I haven't tested the patch yet, but aside from my comment above it LGTM.
>
> The patch doesn't actually have a module_platform_driver_probe()
> yet either, so loading the module wouldn't actually do anything.
Probing with TIMER_OF_DECLARE() just consists of running the match table's data
function pointer. So that is covered by Daniel's patch AFAICT. However, it's
not clear if this implementation allows you to load the kernel module after the
device boots? For example, will the Exynos MCT timer probe if I load the
exynos_mct driver after the device boots? My guess is you'd need to register
the device as a platform device with a dedicated probe function to handle that.
--Will
<snip>