[1/1] usb: host: max3421-hcd: Use module_spi_driver

Message ID 1401364261-2535-1-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat May 29, 2014, 11:51 a.m.
module_spi_driver simplifies the code by eliminating
boilerplate code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/usb/host/max3421-hcd.c |   15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

Comments

David Mosberger May 29, 2014, 4:07 p.m. | #1
On Thu, May 29, 2014 at 5:51 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> module_spi_driver simplifies the code by eliminating
> boilerplate code.

Nice!

Acked-by: David Mosberger <davidm@egauge.net>

>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/usb/host/max3421-hcd.c |   15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
> index 28abda14c5e2..e8568c0f1df3 100644
> --- a/drivers/usb/host/max3421-hcd.c
> +++ b/drivers/usb/host/max3421-hcd.c
> @@ -1919,20 +1919,7 @@ static struct spi_driver max3421_driver = {
>         },
>  };
>
> -static int __init
> -max3421_mod_init(void)
> -{
> -       return spi_register_driver(&max3421_driver);
> -}
> -
> -static void __exit
> -max3421_mod_exit(void)
> -{
> -       spi_unregister_driver(&max3421_driver);
> -}
> -
> -module_init(max3421_mod_init);
> -module_exit(max3421_mod_exit);
> +module_spi_driver(max3421_driver);
>
>  MODULE_DESCRIPTION(DRIVER_DESC);
>  MODULE_AUTHOR("David Mosberger <davidm@egauge.net>");
> --
> 1.7.9.5
>

Patch

diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index 28abda14c5e2..e8568c0f1df3 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1919,20 +1919,7 @@  static struct spi_driver max3421_driver = {
 	},
 };
 
-static int __init
-max3421_mod_init(void)
-{
-	return spi_register_driver(&max3421_driver);
-}
-
-static void __exit
-max3421_mod_exit(void)
-{
-	spi_unregister_driver(&max3421_driver);
-}
-
-module_init(max3421_mod_init);
-module_exit(max3421_mod_exit);
+module_spi_driver(max3421_driver);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_AUTHOR("David Mosberger <davidm@egauge.net>");