From 588646529f2d09b723584d44ef0a8ab6ff2a690d Mon Sep 17 00:00:00 2001 From: Eric Auger Date: Tue, 3 Nov 2015 18:12:14 +0000 Subject: 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 Reviewed-by: Arnd Bergmann Signed-off-by: Alex Williamson --- drivers/vfio/platform/vfio_platform_private.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/vfio') diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index c563940e0f6b..fd262be2a443 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -110,4 +110,18 @@ static struct vfio_platform_reset_node __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 */ -- cgit v1.2.3-58-ga151