diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-02-25 05:25:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-09 19:37:56 -0500 |
commit | cd4946188aac597d187a765127fd26fa3644c29f (patch) | |
tree | 01833671b4891a1489ed0a6a75e37494486801d2 /include/linux/device.h | |
parent | b086cf04fc1bfc89b306aab2fb0f67e3cc294037 (diff) |
driver-core: Allow additional parameters for module_driver
Allow module_driver take additional parameters which will be passed to the
register and unregister function calls. This allows it to be used in cases
where additional parameters are required (e.g. usb_serial_register_drivers).
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index b63fb393aa58..bccccef520dc 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -1007,19 +1007,20 @@ extern long sysfs_deprecated; | |||
1007 | * @__driver: driver name | 1007 | * @__driver: driver name |
1008 | * @__register: register function for this driver type | 1008 | * @__register: register function for this driver type |
1009 | * @__unregister: unregister function for this driver type | 1009 | * @__unregister: unregister function for this driver type |
1010 | * @...: Additional arguments to be passed to __register and __unregister. | ||
1010 | * | 1011 | * |
1011 | * Use this macro to construct bus specific macros for registering | 1012 | * Use this macro to construct bus specific macros for registering |
1012 | * drivers, and do not use it on its own. | 1013 | * drivers, and do not use it on its own. |
1013 | */ | 1014 | */ |
1014 | #define module_driver(__driver, __register, __unregister) \ | 1015 | #define module_driver(__driver, __register, __unregister, ...) \ |
1015 | static int __init __driver##_init(void) \ | 1016 | static int __init __driver##_init(void) \ |
1016 | { \ | 1017 | { \ |
1017 | return __register(&(__driver)); \ | 1018 | return __register(&(__driver) , ##__VA_ARGS__); \ |
1018 | } \ | 1019 | } \ |
1019 | module_init(__driver##_init); \ | 1020 | module_init(__driver##_init); \ |
1020 | static void __exit __driver##_exit(void) \ | 1021 | static void __exit __driver##_exit(void) \ |
1021 | { \ | 1022 | { \ |
1022 | __unregister(&(__driver)); \ | 1023 | __unregister(&(__driver) , ##__VA_ARGS__); \ |
1023 | } \ | 1024 | } \ |
1024 | module_exit(__driver##_exit); | 1025 | module_exit(__driver##_exit); |
1025 | 1026 | ||