@@ -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)
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(+)