aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/soundwire
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2019-06-11 11:40:41 +0100
committerVinod Koul <vkoul@kernel.org>2019-07-01 11:52:43 +0530
commit2aeac95d1a4cc85aae57ab842d5c3340df0f817f (patch)
treedd6449faa5e951461d0162919af7bdf092b1576b /include/linux/soundwire
parentdocs: soundwire: locking: fix tags for a code-block (diff)
downloadwireguard-linux-2aeac95d1a4cc85aae57ab842d5c3340df0f817f.tar.xz
wireguard-linux-2aeac95d1a4cc85aae57ab842d5c3340df0f817f.zip
soundwire: add module_sdw_driver helper macro
This Helper macro is for SoundWire drivers which do not 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() Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'include/linux/soundwire')
-rw-r--r--include/linux/soundwire/sdw_type.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/soundwire/sdw_type.h b/include/linux/soundwire/sdw_type.h
index 9c756b5a0dfe..aaa7f4267c14 100644
--- a/include/linux/soundwire/sdw_type.h
+++ b/include/linux/soundwire/sdw_type.h
@@ -16,4 +16,15 @@ void sdw_unregister_driver(struct sdw_driver *drv);
int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size);
+/**
+ * module_sdw_driver() - Helper macro for registering a Soundwire driver
+ * @__sdw_driver: soundwire slave driver struct
+ *
+ * Helper macro for Soundwire drivers which do not 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_sdw_driver(__sdw_driver) \
+ module_driver(__sdw_driver, sdw_register_driver, \
+ sdw_unregister_driver)
#endif /* __SOUNDWIRE_TYPES_H */