Subject: [PATCH 07/30] drivers: gpio: msic: use subsys_platform_driver()

From: Enrico Weigelt <[email protected]>

Reduce driver init boilerplate by using the new
subsys_platform_driver() macro.

Signed-off-by: Enrico Weigelt <[email protected]>
---
drivers/gpio/gpio-msic.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-msic.c b/drivers/gpio/gpio-msic.c
index 7e3c96e..5903ce3 100644
--- a/drivers/gpio/gpio-msic.c
+++ b/drivers/gpio/gpio-msic.c
@@ -306,9 +306,4 @@ static int platform_msic_gpio_probe(struct platform_device *pdev)
},
.probe = platform_msic_gpio_probe,
};
-
-static int __init platform_msic_gpio_init(void)
-{
- return platform_driver_register(&platform_msic_gpio_driver);
-}
-subsys_initcall(platform_msic_gpio_init);
+subsys_platform_driver(platform_msic_gpio_driver);
--
1.9.1


2019-06-18 09:01:07

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 07/30] drivers: gpio: msic: use subsys_platform_driver()

On Mon, Jun 17, 2019 at 08:40:48PM +0200, Enrico Weigelt, metux IT consult wrote:
> From: Enrico Weigelt <[email protected]>
>
> Reduce driver init boilerplate by using the new
> subsys_platform_driver() macro.

> --- a/drivers/gpio/gpio-msic.c
> +++ b/drivers/gpio/gpio-msic.c
> @@ -306,9 +306,4 @@ static int platform_msic_gpio_probe(struct platform_device *pdev)
> },
> .probe = platform_msic_gpio_probe,
> };
> -
> -static int __init platform_msic_gpio_init(void)
> -{
> - return platform_driver_register(&platform_msic_gpio_driver);
> -}
> -subsys_initcall(platform_msic_gpio_init);
> +subsys_platform_driver(platform_msic_gpio_driver);

How did you test this? Had you even compiled it?

P.S. Perhaps it makes #include <linux/init.h> redundant.

--
With Best Regards,
Andy Shevchenko