@@ -1470,20 +1470,7 @@ static struct i2c_driver gc0310_driver = {
.remove = gc0310_remove,
.id_table = gc0310_id,
};
-
-static int init_gc0310(void)
-{
- return i2c_add_driver(&gc0310_driver);
-}
-
-static void exit_gc0310(void)
-{
-
- i2c_del_driver(&gc0310_driver);
-}
-
-module_init(init_gc0310);
-module_exit(exit_gc0310);
+module_i2c_driver(gc0310_driver);
MODULE_AUTHOR("Lai, Angie <angie.lai@intel.com>");
MODULE_DESCRIPTION("A low-level driver for GalaxyCore GC0310 sensors");
@@ -1199,20 +1199,7 @@ static struct i2c_driver gc2235_driver = {
.remove = gc2235_remove,
.id_table = gc2235_id,
};
-
-static int init_gc2235(void)
-{
- return i2c_add_driver(&gc2235_driver);
-}
-
-static void exit_gc2235(void)
-{
-
- i2c_del_driver(&gc2235_driver);
-}
-
-module_init(init_gc2235);
-module_exit(exit_gc2235);
+module_i2c_driver(gc2235_driver);
MODULE_AUTHOR("Shuguang Gong <Shuguang.Gong@intel.com>");
MODULE_DESCRIPTION("A low-level driver for GC2235 sensors");
@@ -991,19 +991,8 @@ static struct i2c_driver lm3554_driver = {
.remove = lm3554_remove,
.id_table = lm3554_id,
};
+module_i2c_driver(lm3554_driver);
-static __init int init_lm3554(void)
-{
- return i2c_add_driver(&lm3554_driver);
-}
-
-static __exit void exit_lm3554(void)
-{
- i2c_del_driver(&lm3554_driver);
-}
-
-module_init(init_lm3554);
-module_exit(exit_lm3554);
MODULE_AUTHOR("Jing Tao <jing.tao@intel.com>");
MODULE_DESCRIPTION("LED flash driver for LM3554");
MODULE_LICENSE("GPL");
@@ -1945,19 +1945,7 @@ static struct i2c_driver mt9m114_driver = {
.remove = mt9m114_remove,
.id_table = mt9m114_id,
};
-
-static __init int init_mt9m114(void)
-{
- return i2c_add_driver(&mt9m114_driver);
-}
-
-static __exit void exit_mt9m114(void)
-{
- i2c_del_driver(&mt9m114_driver);
-}
-
-module_init(init_mt9m114);
-module_exit(exit_mt9m114);
+module_i2c_driver(mt9m114_driver);
MODULE_AUTHOR("Shuguang Gong <Shuguang.gong@intel.com>");
MODULE_LICENSE("GPL");
@@ -1527,7 +1527,6 @@ MODULE_DEVICE_TABLE(acpi, ov2680_acpi_match);
MODULE_DEVICE_TABLE(i2c, ov2680_id);
static struct i2c_driver ov2680_driver = {
.driver = {
- .owner = THIS_MODULE,
.name = OV2680_NAME,
.acpi_match_table = ACPI_PTR(ov2680_acpi_match),
@@ -1536,20 +1535,7 @@ static struct i2c_driver ov2680_driver = {
.remove = ov2680_remove,
.id_table = ov2680_id,
};
-
-static int init_ov2680(void)
-{
- return i2c_add_driver(&ov2680_driver);
-}
-
-static void exit_ov2680(void)
-{
-
- i2c_del_driver(&ov2680_driver);
-}
-
-module_init(init_ov2680);
-module_exit(exit_ov2680);
+module_i2c_driver(ov2680_driver);
MODULE_AUTHOR("Jacky Wang <Jacky_wang@ovt.com>");
MODULE_DESCRIPTION("A low-level driver for OmniVision 2680 sensors");
@@ -1353,20 +1353,7 @@ static struct i2c_driver ov2722_driver = {
.remove = ov2722_remove,
.id_table = ov2722_id,
};
-
-static int init_ov2722(void)
-{
- return i2c_add_driver(&ov2722_driver);
-}
-
-static void exit_ov2722(void)
-{
-
- i2c_del_driver(&ov2722_driver);
-}
-
-module_init(init_ov2722);
-module_exit(exit_ov2722);
+module_i2c_driver(ov2722_driver);
MODULE_AUTHOR("Wei Liu <wei.liu@intel.com>");
MODULE_DESCRIPTION("A low-level driver for OmniVision 2722 sensors");
@@ -2040,20 +2040,7 @@ static struct i2c_driver ov5693_driver = {
.remove = ov5693_remove,
.id_table = ov5693_id,
};
-
-static int init_ov5693(void)
-{
- return i2c_add_driver(&ov5693_driver);
-}
-
-static void exit_ov5693(void)
-{
-
- i2c_del_driver(&ov5693_driver);
-}
-
-module_init(init_ov5693);
-module_exit(exit_ov5693);
+module_i2c_driver(ov5693_driver);
MODULE_DESCRIPTION("A low-level driver for OmniVision 5693 sensors");
MODULE_LICENSE("GPL");
@@ -2203,19 +2203,7 @@ static struct i2c_driver ov8858_driver = {
.remove = ov8858_remove,
.id_table = ov8858_id,
};
-
-static __init int ov8858_init_mod(void)
-{
- return i2c_add_driver(&ov8858_driver);
-}
-
-static __exit void ov8858_exit_mod(void)
-{
- i2c_del_driver(&ov8858_driver);
-}
-
-module_init(ov8858_init_mod);
-module_exit(ov8858_exit_mod);
+module_i2c_driver(ov8858_driver);
MODULE_DESCRIPTION("A low-level driver for Omnivision OV8858 sensors");
MODULE_LICENSE("GPL");
This is done using coccinelle semantic patch: //<smpl> @a@ identifier f, x; @@ -static f(...) { return i2c_add_driver(&x); } @b depends on a@ identifier e, a.x; @@ -static e(...) { i2c_del_driver(&x); } @c depends on a && b@ identifier a.f; declarer name module_init; @@ -module_init(f); @d depends on a && b && c@ identifier b.e, a.x; declarer name module_exit; declarer name module_i2c_driver; @@ -module_exit(e); +module_i2c_driver(x); //</smpl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/staging/media/atomisp/i2c/gc0310.c | 15 +-------------- drivers/staging/media/atomisp/i2c/gc2235.c | 15 +-------------- drivers/staging/media/atomisp/i2c/lm3554.c | 13 +------------ drivers/staging/media/atomisp/i2c/mt9m114.c | 14 +------------- drivers/staging/media/atomisp/i2c/ov2680.c | 16 +--------------- drivers/staging/media/atomisp/i2c/ov2722.c | 15 +-------------- drivers/staging/media/atomisp/i2c/ov5693/ov5693.c | 15 +-------------- drivers/staging/media/atomisp/i2c/ov8858.c | 14 +------------- 8 files changed, 8 insertions(+), 109 deletions(-)