Re: [PATCH RFC] timer: of: Create a platform_device before the framework is initialized

From: Daniel Lezcano
Date: Thu Jul 10 2025 - 06:54:32 EST


On 08/07/2025 18:10, Arnd Bergmann wrote:

[ ... ]

The way I had expected this to work was that TIMER_OF_DECLARE_PDEV()
always registers the platform_driver and just skips the
section magic when it's in a loadable module.

Yes it would be a nice change, but it seems to be not possible for the early + builtin + module combination we have AFAICS.

What about to have two macros:

/*
* Declares module_platform_driver
* Assigns __driver.driver.of_match_table = __of_match
* Assigns __driver.driver.name = __name
*/
TIMER_OF_DECLARE_PLATFORM_DRIVER(__name, __driver, __of_match)

/*
* Does the same as the above but if MODULE is not set then then we
* end up with timer-probe() instead of builtin_platform_driver
*/
TIMER_OF_DECLARE_EARLY_PLATFORM_DRIVER(__name, __driver, __of_match)

So when someone is converting a driver into a module, it can change the driver to use these macros instead.


--
<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