Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Axel,

On Sun, 27 Nov 2011 14:12:12 +0800, Axel Lin wrote:
> This patch converts the drivers in drivers/i2c/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
> 
> Cc: Jean Delvare <khali@xxxxxxxxxxxx>
> Cc: Ben Dooks <ben-linux@xxxxxxxxx>
> Cc: Jochen Friedrich <jochen@xxxxxxxx>
> Cc: Peter Korsgaard <jacmet@xxxxxxxxxx>
> Cc: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
> Cc: Guan Xuetao <gxt@xxxxxxxxxxxxxxx>
> Cc: Manuel Lauss <manuel.lauss@xxxxxxxxxxxxxx>
> Cc: Barry Song <21cnbao@xxxxxxxxx>
> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Cc: Yong Zhang <yong.zhang0@xxxxxxxxx>
> Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxxxxxxx>
> Cc: Grant Likely <grant.likely@xxxxxxxxxxxx>
> Cc: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
> ---
>  drivers/i2c/busses/i2c-at91.c         |   17 ++---------------
>  drivers/i2c/busses/i2c-au1550.c       |   13 +------------
>  drivers/i2c/busses/i2c-cpm.c          |   13 +------------
>  drivers/i2c/busses/i2c-highlander.c   |   13 +------------
>  drivers/i2c/busses/i2c-ibm_iic.c      |   13 +------------
>  drivers/i2c/busses/i2c-iop3xx.c       |   16 +---------------
>  drivers/i2c/busses/i2c-isch.c         |   13 +------------
>  drivers/i2c/busses/i2c-ixp2000.c      |   13 +------------
>  drivers/i2c/busses/i2c-mpc.c          |   13 +------------
>  drivers/i2c/busses/i2c-mv64xxx.c      |   15 +--------------
>  drivers/i2c/busses/i2c-ocores.c       |   17 ++---------------
>  drivers/i2c/busses/i2c-octeon.c       |   16 +---------------
>  drivers/i2c/busses/i2c-pca-platform.c |   14 +-------------
>  drivers/i2c/busses/i2c-pmcmsp.c       |   17 ++---------------
>  drivers/i2c/busses/i2c-powermac.c     |   19 ++-----------------
>  drivers/i2c/busses/i2c-puv3.c         |   16 ++--------------
>  drivers/i2c/busses/i2c-sh7760.c       |   13 +------------
>  drivers/i2c/busses/i2c-simtec.c       |   20 ++------------------
>  drivers/i2c/busses/i2c-xiic.c         |   18 ++----------------
>  drivers/i2c/muxes/gpio-i2cmux.c       |   13 +------------
>  20 files changed, 27 insertions(+), 275 deletions(-)

Looks overall good. I'd rather let Ben apply it as most affected
drivers are for embedded platforms.

Just two minor comments:

> --- a/drivers/i2c/busses/i2c-simtec.c
> +++ b/drivers/i2c/busses/i2c-simtec.c
> @@ -156,12 +156,6 @@ static int simtec_i2c_remove(struct platform_device *dev)
>  	return 0;
>  }
>  
> -
> -/* device driver */

I see no good reason for removing that comment.

> -
> -/* work with hotplug and coldplug */
> -MODULE_ALIAS("platform:simtec-i2c");
> -
>  static struct platform_driver simtec_i2c_driver = {
>  	.driver		= {
>  		.name		= "simtec-i2c",
> @@ -171,19 +165,9 @@ static struct platform_driver simtec_i2c_driver = {
>  	.remove		= simtec_i2c_remove,
>  };
>  
> -static int __init i2c_adap_simtec_init(void)
> -{
> -	return platform_driver_register(&simtec_i2c_driver);
> -}
> -
> -static void __exit i2c_adap_simtec_exit(void)
> -{
> -	platform_driver_unregister(&simtec_i2c_driver);
> -}
> -
> -module_init(i2c_adap_simtec_init);
> -module_exit(i2c_adap_simtec_exit);
> +module_platform_driver(simtec_i2c_driver);
>  
>  MODULE_DESCRIPTION("Simtec Generic I2C Bus driver");
>  MODULE_AUTHOR("Ben Dooks <ben@xxxxxxxxxxxx>");
>  MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:simtec-i2c");

> (...)
> diff --git a/drivers/i2c/muxes/gpio-i2cmux.c b/drivers/i2c/muxes/gpio-i2cmux.c
> index 7b6ce62..e5fa695 100644
> --- a/drivers/i2c/muxes/gpio-i2cmux.c
> +++ b/drivers/i2c/muxes/gpio-i2cmux.c
> @@ -165,18 +165,7 @@ static struct platform_driver gpiomux_driver = {
>  	},
>  };
>  
> -static int __init gpiomux_init(void)
> -{
> -	return platform_driver_register(&gpiomux_driver);
> -}
> -
> -static void __exit gpiomux_exit(void)
> -{
> -	platform_driver_unregister(&gpiomux_driver);
> -}
> -
> -module_init(gpiomux_init);
> -module_exit(gpiomux_exit);
> +module_platform_driver(gpiomux_driver);

This one would be better as a separate patch, as it touches a different
subdirectory, which I am responsible for.

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


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux