Skip to contentSkip to conversation

extcon: axp288: use module_platform_driver to simplify the code

PATCH In review Liu Shixin 2 participants 2 messages Sep 14, 2020

Subsystems (3)
lore
Share & tools
lore

Liu Shixin

author
#0 lore raw

PATCH 1/1 extcon: axp288: use module_platform_driver to simplify the code

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

---
 drivers/extcon/extcon-axp288.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/extcon/extcon-axp288.c +1 -12
index 525345367260..fdb31954cf2b 100644
@@ -491,18 +491,7 @@ static struct platform_driver axp288_extcon_driver = {
 		.pm = &axp288_extcon_pm_ops,
 	},
 };
-
-static int __init axp288_extcon_init(void)
-{
-	return platform_driver_register(&axp288_extcon_driver);
-}
-module_init(axp288_extcon_init);
-
-static void __exit axp288_extcon_exit(void)
-{
-	platform_driver_unregister(&axp288_extcon_driver);
-}
-module_exit(axp288_extcon_exit);
+module_platform_driver(axp288_extcon_driver);
 
 MODULE_AUTHOR("Ramakrishna Pallala <[email protected]>");
 MODULE_AUTHOR("Hans de Goede <[email protected]>");
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 4 lines · Liu Shixin

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

Thank you for the cleanup, patch looks good to me:

Regards,

Hans

Quoted 29 lines
---
  drivers/extcon/extcon-axp288.c | 13 +------------
  1 file changed, 1 insertion(+), 12 deletions(-)
drivers/extcon/extcon-axp288.c +1 -12
index 525345367260..fdb31954cf2b 100644
@@ -491,18 +491,7 @@ static struct platform_driver axp288_extcon_driver = {
  		.pm = &axp288_extcon_pm_ops,
  	},
  };
-
-static int __init axp288_extcon_init(void)
-{
-	return platform_driver_register(&axp288_extcon_driver);
-}
-module_init(axp288_extcon_init);
-
-static void __exit axp288_extcon_exit(void)
-{
-	platform_driver_unregister(&axp288_extcon_driver);
-}
-module_exit(axp288_extcon_exit);
+module_platform_driver(axp288_extcon_driver);
 
  MODULE_AUTHOR("Ramakrishna Pallala <[email protected]>");
  MODULE_AUTHOR("Hans de Goede <[email protected]>");