]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
soundwire: add module_sdw_driver helper macro
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tue, 11 Jun 2019 10:40:41 +0000 (11:40 +0100)
committerVinod Koul <vkoul@kernel.org>
Mon, 1 Jul 2019 06:22:43 +0000 (11:52 +0530)
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>
include/linux/soundwire/sdw_type.h

index 9c756b5a0dfe8b3103c2057002c9ae24630aee27..aaa7f4267c149a62e81907584cc889f244c86a31 100644 (file)
@@ -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 */