i2c: adv7183: use module_i2c_driver to simplify the code

Message ID CAPgLHd_dS4oPpEnTG2uJ-5dGgcU9Ebxk-TEggOU5Z94iY3qBpg@mail.gmail.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Wei Yongjun Oct. 8, 2012, 2:13 p.m. UTC
  From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Use the module_i2c_driver() macro to make the code smaller
and a bit simpler.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/media/i2c/adv7183.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Comments

Scott Jiang Oct. 9, 2012, 6:10 a.m. UTC | #1
2012/10/8 Wei Yongjun <weiyj.lk@gmail.com>:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Use the module_i2c_driver() macro to make the code smaller
> and a bit simpler.
>
> dpatch engine is used to auto generate this patch.
> (https://github.com/weiyj/dpatch)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>

> ---
>  drivers/media/i2c/adv7183.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
> index e1d4c89..10c3c1d 100644
> --- a/drivers/media/i2c/adv7183.c
> +++ b/drivers/media/i2c/adv7183.c
> @@ -681,18 +681,7 @@ static struct i2c_driver adv7183_driver = {
>         .id_table       = adv7183_id,
>  };
>
> -static __init int adv7183_init(void)
> -{
> -       return i2c_add_driver(&adv7183_driver);
> -}
> -
> -static __exit void adv7183_exit(void)
> -{
> -       i2c_del_driver(&adv7183_driver);
> -}
> -
> -module_init(adv7183_init);
> -module_exit(adv7183_exit);
> +module_i2c_driver(adv7183_driver);
>
>  MODULE_DESCRIPTION("Analog Devices ADV7183 video decoder driver");
>  MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>");
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
index e1d4c89..10c3c1d 100644
--- a/drivers/media/i2c/adv7183.c
+++ b/drivers/media/i2c/adv7183.c
@@ -681,18 +681,7 @@  static struct i2c_driver adv7183_driver = {
 	.id_table       = adv7183_id,
 };
 
-static __init int adv7183_init(void)
-{
-	return i2c_add_driver(&adv7183_driver);
-}
-
-static __exit void adv7183_exit(void)
-{
-	i2c_del_driver(&adv7183_driver);
-}
-
-module_init(adv7183_init);
-module_exit(adv7183_exit);
+module_i2c_driver(adv7183_driver);
 
 MODULE_DESCRIPTION("Analog Devices ADV7183 video decoder driver");
 MODULE_AUTHOR("Scott Jiang <Scott.Jiang.Linux@gmail.com>");