lkml.org 
[lkml]   [2019]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 01/30] include: linux: platform_device: more helpers for declaring platform drivers
From
Date
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@metux.net -- +49-151-27565287

\
 
 \ /
  Last update: 2019-06-26 19:34    [W:0.237 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site