Skip to content

Commit

Permalink
vfio: platform: introduce module_vfio_reset_handler macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Auger authored and Alex Williamson committed Nov 3, 2015
1 parent e086497 commit 5886465
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/vfio/platform/vfio_platform_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 5886465

Please sign in to comment.