[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1360669793-6921-3-git-send-email-sjur.brandeland@stericsson.com>
Date: Tue, 12 Feb 2013 12:49:52 +0100
From: sjur.brandeland@...ricsson.com
To: Rusty Russell <rusty@...tcorp.com.au>,
"David S. Miller" <davem@...emloft.net>,
Ohad Ben-Cohen <ohad@...ery.com>
Cc: sjur@...ndeland.net, netdev@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org,
Dmitry Tarnyagin <dmitry.tarnyagin@...ricsson.com>,
Linus Walleij <linus.walleij@...aro.org>,
Erwan Yvin <erwan.yvin@...ricsson.com>,
Sjur Brændeland <sjur.brandeland@...ricsson.com>
Subject: [PATCHv2 vringh 2/3] virtio: Add module driver macro for virtio drivers.
From: Sjur Brændeland <sjur.brandeland@...ricsson.com>
Add helper macro for drivers that don't do anything
special in module init/exit.
Signed-off-by: Sjur Brændeland <sjur.brandeland@...ricsson.com>
---
include/linux/virtio.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index cf8adb1..00ccc40 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 */
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists