summaryrefslogtreecommitdiff
path: root/drivers/vfio/platform
diff options
context:
space:
mode:
authorEric Auger <eric.auger@linaro.org>2015-11-03 18:12:14 +0000
committerAlex Williamson <alex.williamson@redhat.com>2015-11-03 12:54:59 -0700
commit588646529f2d09b723584d44ef0a8ab6ff2a690d (patch)
tree65168bc6a78e2bcc7419e5615f0d188d9e46af62 /drivers/vfio/platform
parente086497d313cbcffcdb5405a5a268961b53519b1 (diff)
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>
Diffstat (limited to 'drivers/vfio/platform')
-rw-r--r--drivers/vfio/platform/vfio_platform_private.h14
1 files changed, 14 insertions, 0 deletions
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 */