public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver
@ 2012-01-21  6:42 Axel Lin
  2012-01-21  7:55 ` Ryan Mallon
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Axel Lin @ 2012-01-21  6:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ryan Mallon, Woogyom Kim, Daniel Jeong, Minkyu Kang, MyungJoo Ham,
	Rhyland Klein, Peter Edwards, Anton Vorontsov

Factor out some boilerplate code for i2c driver registration
into module_i2c_driver.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Woogyom Kim <milo.kim@ti.com>
Cc: Daniel Jeong <daniel.jeong@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Rhyland Klein <rklein@nvidia.com>
Cc: Peter Edwards <sweetlilmre@gmail.com>
---
 drivers/power/ds2782_battery.c   |   12 +-----------
 drivers/power/lp8727_charger.c   |   13 +------------
 drivers/power/max17040_battery.c |   12 +-----------
 drivers/power/max17042_battery.c |   12 +-----------
 drivers/power/sbs-battery.c      |   12 +-----------
 drivers/power/z2_battery.c       |   13 +------------
 6 files changed, 6 insertions(+), 68 deletions(-)

diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
index bfbce5d..6e3d76a 100644
--- a/drivers/power/ds2782_battery.c
+++ b/drivers/power/ds2782_battery.c
@@ -404,17 +404,7 @@ static struct i2c_driver ds278x_battery_driver = {
 	.id_table	= ds278x_id,
 };
 
-static int __init ds278x_init(void)
-{
-	return i2c_add_driver(&ds278x_battery_driver);
-}
-module_init(ds278x_init);
-
-static void __exit ds278x_exit(void)
-{
-	i2c_del_driver(&ds278x_battery_driver);
-}
-module_exit(ds278x_exit);
+module_i2c_driver(ds278x_battery_driver);
 
 MODULE_AUTHOR("Ryan Mallon");
 MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver");
diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c
index b15b575..30de637 100644
--- a/drivers/power/lp8727_charger.c
+++ b/drivers/power/lp8727_charger.c
@@ -475,18 +475,7 @@ static struct i2c_driver lp8727_driver = {
 	.id_table = lp8727_ids,
 };
 
-static int __init lp8727_init(void)
-{
-	return i2c_add_driver(&lp8727_driver);
-}
-
-static void __exit lp8727_exit(void)
-{
-	i2c_del_driver(&lp8727_driver);
-}
-
-module_init(lp8727_init);
-module_exit(lp8727_exit);
+module_i2c_driver(lp8727_driver);
 
 MODULE_DESCRIPTION("National Semiconductor LP8727 charger driver");
 MODULE_AUTHOR
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c
index 2f2f9a6..1c8dd0e 100644
--- a/drivers/power/max17040_battery.c
+++ b/drivers/power/max17040_battery.c
@@ -291,17 +291,7 @@ static struct i2c_driver max17040_i2c_driver = {
 	.id_table	= max17040_id,
 };
 
-static int __init max17040_init(void)
-{
-	return i2c_add_driver(&max17040_i2c_driver);
-}
-module_init(max17040_init);
-
-static void __exit max17040_exit(void)
-{
-	i2c_del_driver(&max17040_i2c_driver);
-}
-module_exit(max17040_exit);
+module_i2c_driver(max17040_i2c_driver);
 
 MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>");
 MODULE_DESCRIPTION("MAX17040 Fuel Gauge");
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index 86acee2..b2fd9e2 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -288,17 +288,7 @@ static struct i2c_driver max17042_i2c_driver = {
 	.id_table	= max17042_id,
 };
 
-static int __init max17042_init(void)
-{
-	return i2c_add_driver(&max17042_i2c_driver);
-}
-module_init(max17042_init);
-
-static void __exit max17042_exit(void)
-{
-	i2c_del_driver(&max17042_i2c_driver);
-}
-module_exit(max17042_exit);
+module_i2c_driver(max17042_i2c_driver);
 
 MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
 MODULE_DESCRIPTION("MAX17042 Fuel Gauge");
diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
index 9ff8af0..4f05498 100644
--- a/drivers/power/sbs-battery.c
+++ b/drivers/power/sbs-battery.c
@@ -853,17 +853,7 @@ static struct i2c_driver sbs_battery_driver = {
 	},
 };
 
-static int __init sbs_battery_init(void)
-{
-	return i2c_add_driver(&sbs_battery_driver);
-}
-module_init(sbs_battery_init);
-
-static void __exit sbs_battery_exit(void)
-{
-	i2c_del_driver(&sbs_battery_driver);
-}
-module_exit(sbs_battery_exit);
+module_i2c_driver(sbs_battery_driver);
 
 MODULE_DESCRIPTION("SBS battery monitor driver");
 MODULE_LICENSE("GPL");
diff --git a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c
index 636ebb2..15c3fba 100644
--- a/drivers/power/z2_battery.c
+++ b/drivers/power/z2_battery.c
@@ -317,18 +317,7 @@ static struct i2c_driver z2_batt_driver = {
 	.id_table	= z2_batt_id,
 };
 
-static int __init z2_batt_init(void)
-{
-	return i2c_add_driver(&z2_batt_driver);
-}
-
-static void __exit z2_batt_exit(void)
-{
-	i2c_del_driver(&z2_batt_driver);
-}
-
-module_init(z2_batt_init);
-module_exit(z2_batt_exit);
+module_i2c_driver(z2_batt_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Peter Edwards <sweetlilmre@gmail.com>");
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver
  2012-01-21  6:42 [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver Axel Lin
@ 2012-01-21  7:55 ` Ryan Mallon
  2012-01-21 18:42 ` Kim, Milo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ryan Mallon @ 2012-01-21  7:55 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Woogyom Kim, Daniel Jeong, Minkyu Kang,
	MyungJoo Ham, Rhyland Klein, Peter Edwards, Anton Vorontsov

On 21/01/12 17:42, Axel Lin wrote:
> Factor out some boilerplate code for i2c driver registration
> into module_i2c_driver.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> Cc: Ryan Mallon <rmallon@gmail.com>
> Cc: Woogyom Kim <milo.kim@ti.com>
> Cc: Daniel Jeong <daniel.jeong@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Rhyland Klein <rklein@nvidia.com>
> Cc: Peter Edwards <sweetlilmre@gmail.com>
> ---
>  drivers/power/ds2782_battery.c   |   12 +-----------
>  drivers/power/lp8727_charger.c   |   13 +------------
>  drivers/power/max17040_battery.c |   12 +-----------
>  drivers/power/max17042_battery.c |   12 +-----------
>  drivers/power/sbs-battery.c      |   12 +-----------
>  drivers/power/z2_battery.c       |   13 +------------
>  6 files changed, 6 insertions(+), 68 deletions(-)
>
> diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
> index bfbce5d..6e3d76a 100644
> --- a/drivers/power/ds2782_battery.c
> +++ b/drivers/power/ds2782_battery.c
> @@ -404,17 +404,7 @@ static struct i2c_driver ds278x_battery_driver = {
>  	.id_table	= ds278x_id,
>  };
>  
> -static int __init ds278x_init(void)
> -{
> -	return i2c_add_driver(&ds278x_battery_driver);
> -}
> -module_init(ds278x_init);
> -
> -static void __exit ds278x_exit(void)
> -{
> -	i2c_del_driver(&ds278x_battery_driver);
> -}
> -module_exit(ds278x_exit);
> +module_i2c_driver(ds278x_battery_driver);
>  
>  MODULE_AUTHOR("Ryan Mallon");
>  MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver");

For ds2782:

Acked-by: Ryan Mallon <rmallon@gmail.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver
  2012-01-21  6:42 [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver Axel Lin
  2012-01-21  7:55 ` Ryan Mallon
@ 2012-01-21 18:42 ` Kim, Milo
  2012-01-23 19:28 ` Rhyland Klein
  2012-03-15 17:15 ` Anton Vorontsov
  3 siblings, 0 replies; 5+ messages in thread
From: Kim, Milo @ 2012-01-21 18:42 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel@vger.kernel.org, Ryan Mallon, Jeong, Daniel,
	Minkyu Kang, MyungJoo Ham, Rhyland Klein, Peter Edwards,
	Anton Vorontsov

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 5264 bytes --]

For lp8727_charger:
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>

Thanks !

Best Regards,
Milo -

-----Original Message-----
From: Axel Lin [mailto:axel.lin@gmail.com] 
Sent: Saturday, January 21, 2012 3:43 PM
To: linux-kernel@vger.kernel.org
Cc: Ryan Mallon; Kim, Milo; Jeong, Daniel; Minkyu Kang; MyungJoo Ham; Rhyland Klein; Peter Edwards; Anton Vorontsov
Subject: [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver

Factor out some boilerplate code for i2c driver registration
into module_i2c_driver.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Woogyom Kim <milo.kim@ti.com>
Cc: Daniel Jeong <daniel.jeong@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Rhyland Klein <rklein@nvidia.com>
Cc: Peter Edwards <sweetlilmre@gmail.com>
---
 drivers/power/ds2782_battery.c   |   12 +-----------
 drivers/power/lp8727_charger.c   |   13 +------------
 drivers/power/max17040_battery.c |   12 +-----------
 drivers/power/max17042_battery.c |   12 +-----------
 drivers/power/sbs-battery.c      |   12 +-----------
 drivers/power/z2_battery.c       |   13 +------------
 6 files changed, 6 insertions(+), 68 deletions(-)

diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
index bfbce5d..6e3d76a 100644
--- a/drivers/power/ds2782_battery.c
+++ b/drivers/power/ds2782_battery.c
@@ -404,17 +404,7 @@ static struct i2c_driver ds278x_battery_driver = {
 	.id_table	= ds278x_id,
 };
 
-static int __init ds278x_init(void)
-{
-	return i2c_add_driver(&ds278x_battery_driver);
-}
-module_init(ds278x_init);
-
-static void __exit ds278x_exit(void)
-{
-	i2c_del_driver(&ds278x_battery_driver);
-}
-module_exit(ds278x_exit);
+module_i2c_driver(ds278x_battery_driver);
 
 MODULE_AUTHOR("Ryan Mallon");
 MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver");
diff --git a/drivers/power/lp8727_charger.c b/drivers/power/lp8727_charger.c
index b15b575..30de637 100644
--- a/drivers/power/lp8727_charger.c
+++ b/drivers/power/lp8727_charger.c
@@ -475,18 +475,7 @@ static struct i2c_driver lp8727_driver = {
 	.id_table = lp8727_ids,
 };
 
-static int __init lp8727_init(void)
-{
-	return i2c_add_driver(&lp8727_driver);
-}
-
-static void __exit lp8727_exit(void)
-{
-	i2c_del_driver(&lp8727_driver);
-}
-
-module_init(lp8727_init);
-module_exit(lp8727_exit);
+module_i2c_driver(lp8727_driver);
 
 MODULE_DESCRIPTION("National Semiconductor LP8727 charger driver");
 MODULE_AUTHOR
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c
index 2f2f9a6..1c8dd0e 100644
--- a/drivers/power/max17040_battery.c
+++ b/drivers/power/max17040_battery.c
@@ -291,17 +291,7 @@ static struct i2c_driver max17040_i2c_driver = {
 	.id_table	= max17040_id,
 };
 
-static int __init max17040_init(void)
-{
-	return i2c_add_driver(&max17040_i2c_driver);
-}
-module_init(max17040_init);
-
-static void __exit max17040_exit(void)
-{
-	i2c_del_driver(&max17040_i2c_driver);
-}
-module_exit(max17040_exit);
+module_i2c_driver(max17040_i2c_driver);
 
 MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>");
 MODULE_DESCRIPTION("MAX17040 Fuel Gauge");
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index 86acee2..b2fd9e2 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -288,17 +288,7 @@ static struct i2c_driver max17042_i2c_driver = {
 	.id_table	= max17042_id,
 };
 
-static int __init max17042_init(void)
-{
-	return i2c_add_driver(&max17042_i2c_driver);
-}
-module_init(max17042_init);
-
-static void __exit max17042_exit(void)
-{
-	i2c_del_driver(&max17042_i2c_driver);
-}
-module_exit(max17042_exit);
+module_i2c_driver(max17042_i2c_driver);
 
 MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
 MODULE_DESCRIPTION("MAX17042 Fuel Gauge");
diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
index 9ff8af0..4f05498 100644
--- a/drivers/power/sbs-battery.c
+++ b/drivers/power/sbs-battery.c
@@ -853,17 +853,7 @@ static struct i2c_driver sbs_battery_driver = {
 	},
 };
 
-static int __init sbs_battery_init(void)
-{
-	return i2c_add_driver(&sbs_battery_driver);
-}
-module_init(sbs_battery_init);
-
-static void __exit sbs_battery_exit(void)
-{
-	i2c_del_driver(&sbs_battery_driver);
-}
-module_exit(sbs_battery_exit);
+module_i2c_driver(sbs_battery_driver);
 
 MODULE_DESCRIPTION("SBS battery monitor driver");
 MODULE_LICENSE("GPL");
diff --git a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c
index 636ebb2..15c3fba 100644
--- a/drivers/power/z2_battery.c
+++ b/drivers/power/z2_battery.c
@@ -317,18 +317,7 @@ static struct i2c_driver z2_batt_driver = {
 	.id_table	= z2_batt_id,
 };
 
-static int __init z2_batt_init(void)
-{
-	return i2c_add_driver(&z2_batt_driver);
-}
-
-static void __exit z2_batt_exit(void)
-{
-	i2c_del_driver(&z2_batt_driver);
-}
-
-module_init(z2_batt_init);
-module_exit(z2_batt_exit);
+module_i2c_driver(z2_batt_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Peter Edwards <sweetlilmre@gmail.com>");
-- 
1.7.5.4



ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver
  2012-01-21  6:42 [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver Axel Lin
  2012-01-21  7:55 ` Ryan Mallon
  2012-01-21 18:42 ` Kim, Milo
@ 2012-01-23 19:28 ` Rhyland Klein
  2012-03-15 17:15 ` Anton Vorontsov
  3 siblings, 0 replies; 5+ messages in thread
From: Rhyland Klein @ 2012-01-23 19:28 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel@vger.kernel.org, Ryan Mallon, Woogyom Kim,
	Daniel Jeong, Minkyu Kang, MyungJoo Ham, Peter Edwards,
	Anton Vorontsov

On Fri, 2012-01-20 at 22:42 -0800, Axel Lin wrote:
> diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
> index 9ff8af0..4f05498 100644
> --- a/drivers/power/sbs-battery.c
> +++ b/drivers/power/sbs-battery.c
> @@ -853,17 +853,7 @@ static struct i2c_driver sbs_battery_driver = {
>  	},
>  };
>  
> -static int __init sbs_battery_init(void)
> -{
> -	return i2c_add_driver(&sbs_battery_driver);
> -}
> -module_init(sbs_battery_init);
> -
> -static void __exit sbs_battery_exit(void)
> -{
> -	i2c_del_driver(&sbs_battery_driver);
> -}
> -module_exit(sbs_battery_exit);
> +module_i2c_driver(sbs_battery_driver);

For sbs-battery
Acked-by Rhyland Klein <rklein@nvidia.com>

-Rhyland


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver
  2012-01-21  6:42 [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver Axel Lin
                   ` (2 preceding siblings ...)
  2012-01-23 19:28 ` Rhyland Klein
@ 2012-03-15 17:15 ` Anton Vorontsov
  3 siblings, 0 replies; 5+ messages in thread
From: Anton Vorontsov @ 2012-03-15 17:15 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Ryan Mallon, Woogyom Kim, Daniel Jeong, Minkyu Kang,
	MyungJoo Ham, Rhyland Klein, Peter Edwards

On Sat, Jan 21, 2012 at 02:42:54PM +0800, Axel Lin wrote:
> Factor out some boilerplate code for i2c driver registration
> into module_i2c_driver.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> Cc: Ryan Mallon <rmallon@gmail.com>
> Cc: Woogyom Kim <milo.kim@ti.com>
> Cc: Daniel Jeong <daniel.jeong@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Rhyland Klein <rklein@nvidia.com>
> Cc: Peter Edwards <sweetlilmre@gmail.com>
> ---
>  drivers/power/ds2782_battery.c   |   12 +-----------
>  drivers/power/lp8727_charger.c   |   13 +------------
>  drivers/power/max17040_battery.c |   12 +-----------
>  drivers/power/max17042_battery.c |   12 +-----------
>  drivers/power/sbs-battery.c      |   12 +-----------
>  drivers/power/z2_battery.c       |   13 +------------
>  6 files changed, 6 insertions(+), 68 deletions(-)
> 
> diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
> index bfbce5d..6e3d76a 100644
> --- a/drivers/power/ds2782_battery.c
> +++ b/drivers/power/ds2782_battery.c
> @@ -404,17 +404,7 @@ static struct i2c_driver ds278x_battery_driver = {
>  	.id_table	= ds278x_id,
>  };
>  

Cosmetic nit: I don't think that there should be an empty line.
I.e. it should be just as we do with MODULE_DEVICE_TABLE and
other macros:

static const struct i2c_device_id .. = {
	...
};
MODULE_DEVICE_TABLE(...)

static struct i2c_driver ... = {
	...
};
module_i2c_driver(...);

I fixed it up and applied the patch. Thanks!

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-15 17:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-21  6:42 [PATCH] power_supply: Convert power_supply i2c drivers to module_i2c_driver Axel Lin
2012-01-21  7:55 ` Ryan Mallon
2012-01-21 18:42 ` Kim, Milo
2012-01-23 19:28 ` Rhyland Klein
2012-03-15 17:15 ` Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox