Re: [PATCH TRIVIAL 1/5] Input: keyboard: use macro module_platform_driver()

From: Linus Walleij
Date: Tue Nov 22 2011 - 04:23:16 EST


On Tue, Nov 22, 2011 at 10:00 AM, JJ Ding <jj_ding@xxxxxxxxxx> wrote:

> Commit 940ab88962bc1aff3273a8356d64577a6e386736 introduced a new macro to
> save some platform_driver boilerplate code. Use it.
>
> Signed-off-by: JJ Ding <dgdunix@xxxxxxxxx>
(...)
> diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c
> index fcdec5e..6c4828f 100644
> --- a/drivers/input/keyboard/nomadik-ske-keypad.c
> +++ b/drivers/input/keyboard/nomadik-ske-keypad.c
> @@ -390,18 +390,7 @@ struct platform_driver ske_keypad_driver = {
>        .probe = ske_keypad_probe,
>        .remove = __devexit_p(ske_keypad_remove),
>  };
> -
> -static int __init ske_keypad_init(void)
> -{
> -       return platform_driver_probe(&ske_keypad_driver, ske_keypad_probe);
> -}
> -module_init(ske_keypad_init);
> -
> -static void __exit ske_keypad_exit(void)
> -{
> -       platform_driver_unregister(&ske_keypad_driver);
> -}
> -module_exit(ske_keypad_exit);
> +module_platform_driver(ske_keypad_driver);
>
>  MODULE_LICENSE("GPL v2");
>  MODULE_AUTHOR("Naveen Kumar <naveen.gaddipati@xxxxxxxxxxxxxx> / Sundar Iyer <sundar.iyer@xxxxxxxxxxxxxx>");

This actually also fixes a bug since platform_driver_probe() was used even
though there is a .probe member in the driver struct, so thanks.

Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/