summaryrefslogtreecommitdiff
path: root/include/linux/virtio.h
diff options
context:
space:
mode:
authorSjur Brændeland <sjur.brandeland@stericsson.com>2013-02-13 09:22:36 +0400
committerRusty Russell <rusty@rustcorp.com.au>2013-02-13 10:30:32 +0400
commit6e105e0593055dc4aae21df7bca3868045754148 (patch)
tree87fc747585c5a77cebc6b94e3f2e39de366b6d9a /include/linux/virtio.h
parentdc18f0800f5f16460030a9623d4fcc165d607edf (diff)
downloadlinux-6e105e0593055dc4aae21df7bca3868045754148.tar.xz
virtio: Add module driver macro for virtio drivers.
Add helper macro for drivers that don't do anything special in module init/exit. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/virtio.h')
-rw-r--r--include/linux/virtio.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index eb34cf774473..ff6714e6d0f5 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -126,4 +126,13 @@ static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv)
int register_virtio_driver(struct virtio_driver *drv);
void unregister_virtio_driver(struct virtio_driver *drv);
+
+/* module_virtio_driver() - Helper macro for drivers that don't do
+ * anything special in module init/exit. This eliminates a lot of
+ * boilerplate. Each module may only use this macro once, and
+ * calling it replaces module_init() and module_exit()
+ */
+#define module_virtio_driver(__virtio_driver) \
+ module_driver(__virtio_driver, register_virtio_driver, \
+ unregister_virtio_driver)
#endif /* _LINUX_VIRTIO_H */