summaryrefslogtreecommitdiff
path: root/drivers/w1/w1_family.h
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2016-08-02 14:07:09 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-02 19:35:39 -0400
commit939fc832290d548a02b6a309992b3c1ff7de1ff9 (patch)
treeec7f08bea46363dc89e423c13f8a782ba3574b24 /drivers/w1/w1_family.h
parent098f9fb0c962eb2fdba5f9d34f4cf7a938237184 (diff)
w1: add helper macro module_w1_family
The helper macro module_w1_family can be used in module drivers that only register a w1 driver in their module init functions. Add this macro and use it in all applicable drivers. Link: http://lkml.kernel.org/r/20160531204313.20979-2-afd@ti.com Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/w1/w1_family.h')
-rw-r--r--drivers/w1/w1_family.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
index ed5dcb80a1f7..10a7a0767187 100644
--- a/drivers/w1/w1_family.h
+++ b/drivers/w1/w1_family.h
@@ -88,4 +88,16 @@ struct w1_family * w1_family_registered(u8);
void w1_unregister_family(struct w1_family *);
int w1_register_family(struct w1_family *);
+/**
+ * module_w1_driver() - Helper macro for registering a 1-Wire families
+ * @__w1_family: w1_family struct
+ *
+ * Helper macro for 1-Wire families 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_w1_family(__w1_family) \
+ module_driver(__w1_family, w1_register_family, \
+ w1_unregister_family)
+
#endif /* __W1_FAMILY_H */