Re: [PATCH 01/30] include: linux: platform_device: more helpers for declaring platform drivers
From: Enrico Weigelt, metux IT consult
Date: Wed Jun 26 2019 - 13:33:07 EST
On 26.06.19 08:14, Uwe Kleine-KÃnig wrote:
Hi,
> Would it make sense to do something like:
>
> #define __module_platform_driver(__platform_driver, __initlvl) \
> static int __init __platform_driver##_init(void) \
> { \
> return platform_driver_register(&(__platform_driver)); \
> } \
> __initlvl ## _initcall(__platform_driver##_init); \
> static void __exit __platform_driver##_exit(void) \
> { \
> platform_driver_unregister(&(__platform_driver)); \
> } \
> module_exit(__platform_driver##_exit);
>
> #define postcore_platform_driver(__platform_driver)
__module_platform_driver(__platform_driver, postcore)
> #define subsys_platform_driver(__platform_driver)
__module_platform_driver(__platform_driver, subsys)
> ...
>
> Which would be more compact and makes the difference between these
> macros a bit more obvious.
yeah, could do that, but not sure whether it's really good for
readability when we have so many nested macros :p
OTOH, I didn't want to touch the existing macros for now, just trim down
the actual init boilerplate, postponing further compactions for later.
--mtx
--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@xxxxxxxxx -- +49-151-27565287