Re: [PATCH 01/30] include: linux: platform_device: more helpers for declaring platform drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux