diff mbox

[3/4] i2c: introduce helper macro initcall_i2c_driver()

Message ID 1380518035-5319-4-git-send-email-hanjun.guo@linaro.org
State New
Headers show

Commit Message

Hanjun Guo Sept. 30, 2013, 5:13 a.m. UTC
Introduce a helper macro initcall_i2c_driver() which based on
initcall_driver() for i2c driver to eliminate boilerplate code.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 include/linux/i2c.h |   11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox

Patch

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 2ab11dc..1b87e64 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -542,6 +542,17 @@  static inline int i2c_adapter_id(struct i2c_adapter *adap)
 	module_driver(__i2c_driver, i2c_add_driver, \
 			i2c_del_driver)
 
+/**
+ * initcall_i2c_driver() - Helper macro for registering a I2C driver
+ * for buid-in module with doing nothing special in driver
+ * xxx_initcall/module_exit. This eliminates a lot of boilerplate.
+ * @__type: initcall type
+ * @__i2c_driver: i2c_driver struct
+ */
+#define initcall_i2c_driver(__type, __i2c_driver) \
+	initcall_driver(__type, __i2c_driver, i2c_add_driver, \
+			i2c_del_driver)
+
 #endif /* I2C */
 
 #if IS_ENABLED(CONFIG_OF)