diff mbox series

[1/4] soundwire: add module_sdw_driver helper macro

Message ID 20190328134134.22479-2-srinivas.kandagatla@linaro.org
State Accepted
Commit 2aeac95d1a4cc85aae57ab842d5c3340df0f817f
Headers show
Series soundwire: few trival fixes and cleanups. | expand

Commit Message

Srinivas Kandagatla March 28, 2019, 1:41 p.m. UTC
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>

---
 include/linux/soundwire/sdw_type.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.21.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Comments

Vinod Koul March 29, 2019, 5:38 a.m. UTC | #1
On 28-03-19, 13:41, Srinivas Kandagatla wrote:
> This Helper macro is for Soundwire drivers which do not do anything special in


s/Soundwire/SoundWire

Most of the 'documentation' uses SoundWire as that is spec name, unless
you are referring to subsystem in which case all will be lowercase :)

> 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>

> ---

>  include/linux/soundwire/sdw_type.h | 11 +++++++++++

>  1 file changed, 11 insertions(+)

> 

> diff --git a/include/linux/soundwire/sdw_type.h b/include/linux/soundwire/sdw_type.h

> index 9fd553e553e9..e14843ed13a5 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 */

> -- 

> 2.21.0


-- 
~Vinod
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
diff mbox series

Patch

diff --git a/include/linux/soundwire/sdw_type.h b/include/linux/soundwire/sdw_type.h
index 9fd553e553e9..e14843ed13a5 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 */