Skip to contentSkip to conversation

EDAC/aspeed: use module_platform_driver to simplify the code

PATCH Applied Liu Shixin 3 participants 3 messages Sep 14, 2020 – Sep 16, 2020

Subsystems (3)
lore
Share & tools
lore

Liu Shixin

author
#0 lore raw

PATCH 1/1 EDAC/aspeed: use module_platform_driver to simplify the code

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

---
 drivers/edac/aspeed_edac.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/edac/aspeed_edac.c +1 -17
index fbec28dc661d..fde809efc520 100644
@@ -388,23 +388,7 @@ static struct platform_driver aspeed_driver = {
 	.probe		= aspeed_probe,
 	.remove		= aspeed_remove
 };
-
-
-static int __init aspeed_init(void)
-{
-	return platform_driver_register(&aspeed_driver);
-}
-
-
-static void __exit aspeed_exit(void)
-{
-	platform_driver_unregister(&aspeed_driver);
-}
-
-
-module_init(aspeed_init);
-module_exit(aspeed_exit);
-
+module_platform_driver(aspeed_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Stefan Schaeckeler <[email protected]>");
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Liu Shixin

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

Quoted 36 lines
---
 drivers/edac/aspeed_edac.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/edac/aspeed_edac.c +1 -18
index fbec28dc661d..fde809efc520 100644
@@ -388,23 +388,7 @@ static struct platform_driver aspeed_driver = {
        .probe          = aspeed_probe,
        .remove         = aspeed_remove
 };
-
-
-static int __init aspeed_init(void)
-{
-       return platform_driver_register(&aspeed_driver);
-}
-
-
-static void __exit aspeed_exit(void)
-{
-       platform_driver_unregister(&aspeed_driver);
-}
-
-
-module_init(aspeed_init);
-module_exit(aspeed_exit);
-
+module_platform_driver(aspeed_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Stefan Schaeckeler <[email protected]>");
--

2.25.1

maintainer Applied
#2 lore raw
In reply to Liu Shixin
Quoted 28 lines · Liu Shixin

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

---
 drivers/edac/aspeed_edac.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/edac/aspeed_edac.c +0 -11
index fbec28dc661d..fde809efc520 100644
@@ -388,23 +388,7 @@ static struct platform_driver aspeed_driver = {
 	.probe		= aspeed_probe,
 	.remove		= aspeed_remove
 };
-
-
-static int __init aspeed_init(void)
-{
-	return platform_driver_register(&aspeed_driver);
-}
-
-
-static void __exit aspeed_exit(void)
-{
-	platform_driver_unregister(&aspeed_driver);

drivers/edac/aspeed_edac.c static struct platform_driver aspeed_driver = { · line 394

Quoted 10 lines
drivers/edac/aspeed_edac.c +1 -6
-}
-
-
-module_init(aspeed_init);
-module_exit(aspeed_exit);
-
+module_platform_driver(aspeed_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Stefan Schaeckeler <[email protected]>");

Applied, thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette