i2c: convert drivers/i2c/* to use module_i2c_driver()
Subsystems (3)
PATCH 1/1 i2c: convert drivers/i2c/* to use module_i2c_driver()
This patch converts the drivers in drivers/i2c/* to use the module_i2c_driver() macro which makes the code smaller and a bit simpler.
--- 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(-)
drivers/i2c/i2c-smbus.c +1 -12
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("SMBus protocol extensions support" );
drivers/i2c/muxes/pca9541.c +1 -12
@@ -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/[email protected]>" );MODULE_DESCRIPTION ("PCA9541 I2C master selector driver" );
drivers/i2c/muxes/pca954x.c +1 -12
@@ -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 <[email protected]>" );MODULE_DESCRIPTION ("PCA954x I2C mux/switch driver" );
Signature · 1 line
1.7.5.4
Quoted 9 lines · Axel Lin
This patch converts the drivers in
drivers/i2c/*to use themodule_i2c_driver()macro which makes the code smaller and a bit simpler.Signed-off-by Axel Lin <[email protected]>Cc Wolfram Sang <[email protected]>Cc Guenter Roeck <[email protected]>Cc Jean Delvare <[email protected]>Cc Michael Lawnick <[email protected]>Cc Ben Dooks <[email protected]>
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 4 lines · Wolfram Sang
Quoted 3 lines · Axel Lin
This patch converts the drivers in
drivers/i2c/*to use themodule_i2c_driver()macro which makes the code smaller and a bit simpler.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Axel Lin <[email protected]>Cc Wolfram Sang <[email protected]>Cc Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/[email protected]>Cc Jean Delvare <[email protected]>Cc Michael Lawnick <[email protected]>Cc Ben Dooks <[email protected]>Acked-by Wolfram Sang <[email protected]>
Patch applied, thanks.
Signature · 1 line
Jean Delvare
Quoted 12 lines · Jean Delvare
Quoted 11 lines · Wolfram Sang
Quoted 9 lines · Axel Lin
This patch converts the drivers in
drivers/i2c/*to use themodule_i2c_driver()macro which makes the code smaller and a bit simpler.Signed-off-by Axel Lin <[email protected]>Cc Wolfram Sang <[email protected]>Cc Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/[email protected]>Cc Jean Delvare <[email protected]>Cc Michael Lawnick <[email protected]>Cc Ben Dooks <[email protected]>
Quoted 3 lines
Quoted 1 line
Acked-by Wolfram Sang <[email protected]>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.
Signature · 1 line
Jean Delvare