Skip to contentSkip to conversation

Staging: most: Use module_i2c_driver

PATCH New Shraddha Barke 1 participant 1 message Sep 29, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: most: Use module_i2c_driver

Macro module_i2c_driver is used for drivers whose init and exit paths does only register and unregister to i2c API. Remove some boilerplate code by using module_i2c_driver.

Problem found using Coccinelle.

---
 drivers/staging/most/hdm-i2c/hdm_i2c.c | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)
drivers/staging/most/hdm-i2c/hdm_i2c.c +1 -21
index 029ded3..5fddb28 100644
@@ -423,27 +423,7 @@ static struct i2c_driver i2c_driver = {
 	.id_table = i2c_id,
 };
 
-/**
- * hdm_i2c_init - Driver Registration Routine
- */
-static int __init hdm_i2c_init(void)
-{
-	pr_info("hdm_i2c_init()\n");
-
-	return i2c_add_driver(&i2c_driver);
-}
-
-/**
- * hdm_i2c_exit - Driver Cleanup Routine
- **/
-static void __exit hdm_i2c_exit(void)
-{
-	i2c_del_driver(&i2c_driver);
-	pr_info("hdm_i2c_exit()\n");
-}
-
-module_init(hdm_i2c_init);
-module_exit(hdm_i2c_exit);
+module_i2c_driver(i2c_driver);
 
 MODULE_AUTHOR("Jain Roy Ambi <[email protected]>");
 MODULE_AUTHOR("Andrey Shvetsov <[email protected]>");
Signature · 1 line
2.1.4