vfio: platform: introduce module_vfio_reset_handler macro

The module_vfio_reset_handler macro
- define a module alias
- implement module init/exit function which respectively registers
  and unregisters the reset function.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
Eric Auger 2015-11-03 18:12:14 +00:00 committed by Alex Williamson
parent e086497d31
commit 588646529f

View File

@ -110,4 +110,18 @@ static struct vfio_platform_reset_node __reset ## _node = { \
}; \ }; \
__vfio_platform_register_reset(&__reset ## _node) __vfio_platform_register_reset(&__reset ## _node)
#define module_vfio_reset_handler(compat, reset) \
MODULE_ALIAS("vfio-reset:" compat); \
static int __init reset ## _module_init(void) \
{ \
vfio_platform_register_reset(compat, reset); \
return 0; \
}; \
static void __exit reset ## _module_exit(void) \
{ \
vfio_platform_unregister_reset(compat, reset); \
}; \
module_init(reset ## _module_init); \
module_exit(reset ## _module_exit)
#endif /* VFIO_PLATFORM_PRIVATE_H */ #endif /* VFIO_PLATFORM_PRIVATE_H */