From 73272a7e6b196b3d19710ac38eefef5668776947 Mon Sep 17 00:00:00 2001 From: Fabio Porcedda Date: Wed, 9 Jan 2013 12:15:26 +0100 Subject: [PATCH] --- yaml --- r: 353607 b: refs/heads/master c: bab734fcdf2c690371e6749ce484b17653b3cb0e h: refs/heads/master i: 353605: 552494b59a5415d0d6b9f440b00340780cb4829c 353603: fcf0dd8ff7daa6534ec631055d49516331638311 353599: e5f6da4521f5f3705bad629484c7131cbc04cdd7 v: v3 --- [refs] | 2 +- trunk/include/linux/platform_device.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 9a8dca7546c3..263194765b05 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 53a9c87e7e02abf3575be98c9fb2018fa30a61b9 +refs/heads/master: bab734fcdf2c690371e6749ce484b17653b3cb0e diff --git a/trunk/include/linux/platform_device.h b/trunk/include/linux/platform_device.h index a9ded9a3c175..c082c71f7225 100644 --- a/trunk/include/linux/platform_device.h +++ b/trunk/include/linux/platform_device.h @@ -204,6 +204,24 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data module_driver(__platform_driver, platform_driver_register, \ platform_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 + * calling it replaces module_init() and module_exit() + */ +#define module_platform_driver_probe(__platform_driver, __platform_probe) \ +static int __init __platform_driver##_init(void) \ +{ \ + return platform_driver_probe(&(__platform_driver), \ + __platform_probe); \ +} \ +module_init(__platform_driver##_init); \ +static void __exit __platform_driver##_exit(void) \ +{ \ + platform_driver_unregister(&(__platform_driver)); \ +} \ +module_exit(__platform_driver##_exit); + extern struct platform_device *platform_create_bundle(struct platform_driver *driver, int (*probe)(struct platform_device *), struct resource *res, unsigned int n_res,