linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: convert drivers/i2c/* to use module_i2c_driver()
@ 2012-02-13  9:05 Axel Lin
  2012-02-13 22:26 ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Lin @ 2012-02-13  9:05 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Wolfram Sang, Guenter Roeck, Jean Delvare, Michael Lawnick,
	Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA

This patch converts the drivers in drivers/i2c/* to use the
module_i2c_driver() macro which makes the code smaller and a bit simpler.

Signed-off-by: Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
---
 drivers/i2c/i2c-smbus.c     |   13 +------------
 drivers/i2c/muxes/pca9541.c |   13 +------------
 drivers/i2c/muxes/pca954x.c |   13 +------------
 3 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index f61ccc1..9316705 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -244,18 +244,7 @@ int i2c_handle_smbus_alert(struct i2c_client *ara)
 }
 EXPORT_SYMBOL_GPL(i2c_handle_smbus_alert);
 
-static int __init i2c_smbus_init(void)
-{
-	return i2c_add_driver(&smbalert_driver);
-}
-
-static void __exit i2c_smbus_exit(void)
-{
-	i2c_del_driver(&smbalert_driver);
-}
-
-module_init(i2c_smbus_init);
-module_exit(i2c_smbus_exit);
+module_i2c_driver(smbalert_driver);
 
 MODULE_AUTHOR("Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>");
 MODULE_DESCRIPTION("SMBus protocol extensions support");
diff --git a/drivers/i2c/muxes/pca9541.c b/drivers/i2c/muxes/pca9541.c
index ed699c5..e0df9b6 100644
--- a/drivers/i2c/muxes/pca9541.c
+++ b/drivers/i2c/muxes/pca9541.c
@@ -393,18 +393,7 @@ static struct i2c_driver pca9541_driver = {
 	.id_table = pca9541_id,
 };
 
-static int __init pca9541_init(void)
-{
-	return i2c_add_driver(&pca9541_driver);
-}
-
-static void __exit pca9541_exit(void)
-{
-	i2c_del_driver(&pca9541_driver);
-}
-
-module_init(pca9541_init);
-module_exit(pca9541_exit);
+module_i2c_driver(pca9541_driver);
 
 MODULE_AUTHOR("Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>");
 MODULE_DESCRIPTION("PCA9541 I2C master selector driver");
diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c
index 6f89536..0e37ef2 100644
--- a/drivers/i2c/muxes/pca954x.c
+++ b/drivers/i2c/muxes/pca954x.c
@@ -284,18 +284,7 @@ static struct i2c_driver pca954x_driver = {
 	.id_table	= pca954x_id,
 };
 
-static int __init pca954x_init(void)
-{
-	return i2c_add_driver(&pca954x_driver);
-}
-
-static void __exit pca954x_exit(void)
-{
-	i2c_del_driver(&pca954x_driver);
-}
-
-module_init(pca954x_init);
-module_exit(pca954x_exit);
+module_i2c_driver(pca954x_driver);
 
 MODULE_AUTHOR("Rodolfo Giometti <giometti-k2GhghHVRtY@public.gmane.org>");
 MODULE_DESCRIPTION("PCA954x I2C mux/switch driver");
-- 
1.7.5.4

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

* Re: [PATCH] i2c: convert drivers/i2c/* to use module_i2c_driver()
  2012-02-13  9:05 [PATCH] i2c: convert drivers/i2c/* to use module_i2c_driver() Axel Lin
@ 2012-02-13 22:26 ` Wolfram Sang
       [not found]   ` <20120213222643.GA22686-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2012-02-13 22:26 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Guenter Roeck, Jean Delvare, Michael Lawnick,
	Ben Dooks, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

On Mon, Feb 13, 2012 at 05:05:03PM +0800, Axel Lin wrote:
> This patch converts the drivers in drivers/i2c/* to use the
> module_i2c_driver() macro which makes the code smaller and a bit simpler.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> Cc: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Guenter Roeck <guenter.roeck@ericsson.com>
> Cc: Jean Delvare <khali@linux-fr.org>
> Cc: Michael Lawnick <ml.lawnick@gmx.de>
> Cc: Ben Dooks <ben-linux@fluff.org>

Acked-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] i2c: convert drivers/i2c/* to use module_i2c_driver()
       [not found]   ` <20120213222643.GA22686-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-02-14  9:10     ` Jean Delvare
       [not found]       ` <20120214101013.4133784e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2012-02-14  9:10 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Axel Lin, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Guenter Roeck,
	Michael Lawnick, Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Mon, 13 Feb 2012 23:26:43 +0100, Wolfram Sang wrote:
> On Mon, Feb 13, 2012 at 05:05:03PM +0800, Axel Lin wrote:
> > This patch converts the drivers in drivers/i2c/* to use the
> > module_i2c_driver() macro which makes the code smaller and a bit simpler.
> > 
> > Signed-off-by: Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > Cc: Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
> > Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> > Cc: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
> > Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> 
> Acked-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Patch applied, thanks.

-- 
Jean Delvare

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

* Re: [PATCH] i2c: convert drivers/i2c/* to use module_i2c_driver()
       [not found]       ` <20120214101013.4133784e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
@ 2012-02-14  9:16         ` Jean Delvare
  0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2012-02-14  9:16 UTC (permalink / raw)
  To: Wolfram Sang, Axel Lin
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Guenter Roeck,
	Michael Lawnick, Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Tue, 14 Feb 2012 10:10:13 +0100, Jean Delvare wrote:
> On Mon, 13 Feb 2012 23:26:43 +0100, Wolfram Sang wrote:
> > On Mon, Feb 13, 2012 at 05:05:03PM +0800, Axel Lin wrote:
> > > This patch converts the drivers in drivers/i2c/* to use the
> > > module_i2c_driver() macro which makes the code smaller and a bit simpler.
> > > 
> > > Signed-off-by: Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > > Cc: Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
> > > Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> > > Cc: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
> > > Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> > 
> > Acked-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> 
> Patch applied, thanks.

Hmm, on second thought...

I'm not going to apply the i2c-smbus patch. This is a special module,
it isn't a device driver per se. It happens that right now the only
SMBus extension supported by the i2c-smbus module is SMBus Alert and
it happens that this is implemented as an i2c_driver, but as we add
support for more SMBus extensions to  that driver, the init and exit
functions will likely become more complex, and then we'd have to move
away from module_i2c_driver(). So I'd rather not use it to start with.

I am taking the drivers/i2c/muxes/pca954*.c parts though.

-- 
Jean Delvare

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

end of thread, other threads:[~2012-02-14  9:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-13  9:05 [PATCH] i2c: convert drivers/i2c/* to use module_i2c_driver() Axel Lin
2012-02-13 22:26 ` Wolfram Sang
     [not found]   ` <20120213222643.GA22686-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-02-14  9:10     ` Jean Delvare
     [not found]       ` <20120214101013.4133784e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-02-14  9:16         ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).