Introduce a helper macro initcall_platform_driver() which based on initcall_driver() for platform driver to eliminate boilerplate code.
Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- include/linux/platform_device.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index ce8e4ff..0f37f9d 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -218,6 +218,17 @@ static inline void platform_set_drvdata(struct platform_device *pdev, module_driver(__platform_driver, platform_driver_register, \ platform_driver_unregister)
+/* initcall_platform_driver() - Helper macro for drivers that don't do + * anything special in build-in module xxx_initcall/exit. This eliminates + * a lot of boilerplate. Each driver may only use this macro once, and + * calling it replaces xxx_initcall() and module_exit() + * @__type: initcall type + * @__platform_driver: platform driver struct + */ +#define initcall_platform_driver(__type, __platform_driver) \ + initcall_driver(__type, __platform_driver, platform_driver_register, \ + latform_driver_unregister) + /* module_platform_driver_probe() - Helper macro for drivers that don't do * anything special in module init/exit. This eliminates a lot of * boilerplate. Each module may only use this macro once, and