Skip to contentSkip to conversation

backport module_i2c_driver helper macro

PATCH In review Thierry Escande 3 participants 3 messages Apr 8, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v3 4/8 backport module_i2c_driver helper macro

---
 backport/include/linux/compat-3.3.h |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
backport/include/linux/compat-3.3.h +21 -0
index 2af4a52..ce7e776 100644
@@ -371,6 +371,27 @@ module_exit(__driver##_exit);
 #undef PCI_EXP_TYPE_RC_EC
 #define  PCI_EXP_TYPE_RC_EC    0xa     /* Root Complex Event Collector */
 
+
+/* This backports:
+ *
+ * commit 7c92784a546d2945b6d6973a30f7134be78eb7a4
+ * Author: Lars-Peter Clausen <[email protected]>
+ * Date:   Wed Nov 16 10:13:36 2011 +0100
+ *
+ *     I2C: Add helper macro for i2c_driver boilerplate
+ */
+/**
+ * module_i2c_driver() - Helper macro for registering a I2C driver
+ * @__i2c_driver: i2c_driver struct
+ *
+ * Helper macro for I2C 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_i2c_driver(__i2c_driver) \
+	module_driver(__i2c_driver, i2c_add_driver, \
+			i2c_del_driver)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
 
 #endif /* LINUX_3_3_COMPAT_H */
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 20 lines · Thierry Escande
---
 backport/include/linux/compat-3.3.h |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
backport/include/linux/compat-3.3.h +7 -0
index 2af4a52..ce7e776 100644
@@ -371,6 +371,27 @@ module_exit(__driver##_exit);
 #undef PCI_EXP_TYPE_RC_EC
 #define  PCI_EXP_TYPE_RC_EC    0xa     /* Root Complex Event Collector */
 
+
+/* This backports:
+ *
+ * commit 7c92784a546d2945b6d6973a30f7134be78eb7a4
+ * Author: Lars-Peter Clausen <[email protected]>
+ * Date:   Wed Nov 16 10:13:36 2011 +0100
+ *

backport/include/linux/compat-3.3.h module_exit(__driver##_exit); · line 390

Quoted 10 lines
backport/include/linux/compat-3.3.h +10 -0
+ *     I2C: Add helper macro for i2c_driver boilerplate
+ */
+/**
+ * module_i2c_driver() - Helper macro for registering a I2C driver
+ * @__i2c_driver: i2c_driver struct
+ *
+ * Helper macro for I2C 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_i2c_driver LINUX_BACKPORT(module_i2c_driver)

backport/include/linux/compat-3.3.h module_exit(__driver##_exit); · line 395

Quoted 5 lines
backport/include/linux/compat-3.3.h +4 -0
+#define module_i2c_driver(__i2c_driver) \
+       module_driver(__i2c_driver, i2c_add_driver, \
+                       i2c_del_driver)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */

Luis

#2 lore raw
Quoted 26 lines · Luis R. Rodriguez
Quoted 24 lines · Thierry Escande
---
 backport/include/linux/compat-3.3.h |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
backport/include/linux/compat-3.3.h +11 -0
index 2af4a52..ce7e776 100644
@@ -371,6 +371,27 @@ module_exit(__driver##_exit);
 #undef PCI_EXP_TYPE_RC_EC
 #define  PCI_EXP_TYPE_RC_EC    0xa     /* Root Complex Event Collector */
 
+
+/* This backports:
+ *
+ * commit 7c92784a546d2945b6d6973a30f7134be78eb7a4
+ * Author: Lars-Peter Clausen <[email protected]>
+ * Date:   Wed Nov 16 10:13:36 2011 +0100
+ *
+ *     I2C: Add helper macro for i2c_driver boilerplate
+ */
+/**
+ * module_i2c_driver() - Helper macro for registering a I2C driver
Quoted 10 lines

backport/include/linux/compat-3.3.h module_exit(__driver##_exit); · line 390

Quoted 6 lines
backport/include/linux/compat-3.3.h +6 -0
+ * @__i2c_driver: i2c_driver struct
+ *
+ * Helper macro for I2C 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_i2c_driver LINUX_BACKPORT(module_i2c_driver)

Quoted 1 line
backport/include/linux/compat-3.3.h +1 -0
+#define module_i2c_driver(__i2c_driver) \

It's a macro, why even try this? I'm not even sure that'll _work_ correctly.

johannes