2020-09-14 06:34:51

by Liu Shixin

[permalink] [raw]
Subject: [PATCH -next] pinctrl: sprd: use module_platform_driver to simplify the code

module_platform_driver() makes the code simpler by eliminating
boilerplate code.

Signed-off-by: Liu Shixin <[email protected]>
---
drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c b/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
index 06c8671b40e7..d14f382f2392 100644
--- a/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
+++ b/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
@@ -946,18 +946,7 @@ static struct platform_driver sprd_pinctrl_driver = {
.remove = sprd_pinctrl_remove,
.shutdown = sprd_pinctrl_shutdown,
};
-
-static int sprd_pinctrl_init(void)
-{
- return platform_driver_register(&sprd_pinctrl_driver);
-}
-module_init(sprd_pinctrl_init);
-
-static void sprd_pinctrl_exit(void)
-{
- platform_driver_unregister(&sprd_pinctrl_driver);
-}
-module_exit(sprd_pinctrl_exit);
+module_platform_driver(sprd_pinctrl_driver);

MODULE_DESCRIPTION("SPREADTRUM Pin Controller Driver");
MODULE_AUTHOR("Baolin Wang <[email protected]>");
--
2.25.1


2020-09-14 08:15:56

by Chunyan Zhang

[permalink] [raw]
Subject: Re: [PATCH -next] pinctrl: sprd: use module_platform_driver to simplify the code

On Mon, 14 Sep 2020 at 14:32, Liu Shixin <[email protected]> wrote:
>
> module_platform_driver() makes the code simpler by eliminating
> boilerplate code.
>
> Signed-off-by: Liu Shixin <[email protected]>

Acked-by: Chunyan Zhang <[email protected]>

Thanks,
Chunyan

> ---
> drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c | 13 +------------
> 1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c b/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
> index 06c8671b40e7..d14f382f2392 100644
> --- a/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
> +++ b/drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
> @@ -946,18 +946,7 @@ static struct platform_driver sprd_pinctrl_driver = {
> .remove = sprd_pinctrl_remove,
> .shutdown = sprd_pinctrl_shutdown,
> };
> -
> -static int sprd_pinctrl_init(void)
> -{
> - return platform_driver_register(&sprd_pinctrl_driver);
> -}
> -module_init(sprd_pinctrl_init);
> -
> -static void sprd_pinctrl_exit(void)
> -{
> - platform_driver_unregister(&sprd_pinctrl_driver);
> -}
> -module_exit(sprd_pinctrl_exit);
> +module_platform_driver(sprd_pinctrl_driver);
>
> MODULE_DESCRIPTION("SPREADTRUM Pin Controller Driver");
> MODULE_AUTHOR("Baolin Wang <[email protected]>");
> --
> 2.25.1
>

2020-09-29 12:55:52

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH -next] pinctrl: sprd: use module_platform_driver to simplify the code

On Mon, Sep 14, 2020 at 8:31 AM Liu Shixin <[email protected]> wrote:

> module_platform_driver() makes the code simpler by eliminating
> boilerplate code.
>
> Signed-off-by: Liu Shixin <[email protected]>

Patch applied!

Yours,
Linus Walleij