[1/1] gspca: Use module_usb_driver macro

Message ID 1355302692-28475-1-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State Superseded, archived
Headers

Commit Message

Sachin Kamat Dec. 12, 2012, 8:58 a.m. UTC
  module_usb_driver eliminates a lot of boilerplate by replacing
module_init() and module_exit() calls.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Compile tested with linux-next
---
 drivers/media/usb/gspca/jl2005bcd.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)
  

Comments

Hans de Goede Dec. 21, 2012, 11:12 a.m. UTC | #1
Hi,

On 12/12/2012 09:58 AM, Sachin Kamat wrote:
> module_usb_driver eliminates a lot of boilerplate by replacing
> module_init() and module_exit() calls.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>

Thanks I've added this patch to my tree, and it will be included
in my fixes pull-req for 3.8 to Mauro later today.

Regards,

Hans

> ---
> Compile tested with linux-next
> ---
>   drivers/media/usb/gspca/jl2005bcd.c |   18 +-----------------
>   1 files changed, 1 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/media/usb/gspca/jl2005bcd.c b/drivers/media/usb/gspca/jl2005bcd.c
> index 62ba80d..fdaeeb1 100644
> --- a/drivers/media/usb/gspca/jl2005bcd.c
> +++ b/drivers/media/usb/gspca/jl2005bcd.c
> @@ -536,20 +536,4 @@ static struct usb_driver sd_driver = {
>   #endif
>   };
>
> -/* -- module insert / remove -- */
> -static int __init sd_mod_init(void)
> -{
> -	int ret;
> -
> -	ret = usb_register(&sd_driver);
> -	if (ret < 0)
> -		return ret;
> -	return 0;
> -}
> -static void __exit sd_mod_exit(void)
> -{
> -	usb_deregister(&sd_driver);
> -}
> -
> -module_init(sd_mod_init);
> -module_exit(sd_mod_exit);
> +module_usb_driver(sd_driver);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/usb/gspca/jl2005bcd.c b/drivers/media/usb/gspca/jl2005bcd.c
index 62ba80d..fdaeeb1 100644
--- a/drivers/media/usb/gspca/jl2005bcd.c
+++ b/drivers/media/usb/gspca/jl2005bcd.c
@@ -536,20 +536,4 @@  static struct usb_driver sd_driver = {
 #endif
 };
 
-/* -- module insert / remove -- */
-static int __init sd_mod_init(void)
-{
-	int ret;
-
-	ret = usb_register(&sd_driver);
-	if (ret < 0)
-		return ret;
-	return 0;
-}
-static void __exit sd_mod_exit(void)
-{
-	usb_deregister(&sd_driver);
-}
-
-module_init(sd_mod_init);
-module_exit(sd_mod_exit);
+module_usb_driver(sd_driver);