linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] rc/keymaps: Add helper macro for rc_map_list boilerplate
@ 2015-07-11  3:17 Vaishali Thakkar
  2016-11-18 15:52 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 2+ messages in thread
From: Vaishali Thakkar @ 2015-07-11  3:17 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, linux-kernel

For simple modules that contain a single rc_map_list without any
additional setup code then ends up being a block of duplicated
boilerplate. This patch adds a new macro, module_rc_map_list(),
which replaces the module_init()/module_exit() registrations with
template functions.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
---
 include/media/rc-map.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 27763d5..07e765d 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -96,6 +96,16 @@ struct rc_map_list {
 	struct rc_map map;
 };
 
+/**
+ * module_rc_map_list() - Helper macro for registering a RC drivers
+ * @__rc_map_list: rc_map_list struct
+ * Helper macro for RC 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_rc_map_list(__rc_map_list) \
+	module_driver(__rc_map_list, rc_map_register, rc_map_unregister)
+
 /* Routines from rc-map.c */
 
 int rc_map_register(struct rc_map_list *map);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-18 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-11  3:17 [PATCH] [media] rc/keymaps: Add helper macro for rc_map_list boilerplate Vaishali Thakkar
2016-11-18 15:52 ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).