Skip to contentSkip to conversation

clk: s2mps11: initialize driver via module_platform_driver

PATCH Applied Krzysztof Kozlowski 3 participants 3 messages Sep 21, 2020 – Sep 22, 2020

Subsystems (3)
lore
Share & tools
lore

Krzysztof Kozlowski

author maintainer
#0 lore raw

PATCH 1/1 clk: s2mps11: initialize driver via module_platform_driver

The driver was using subsys_initcall() because in old times deferred probe was not supported everywhere and specific ordering was needed. Since probe deferral works fine and specific ordering is discouraged (hides dependencies between drivers and couples their boot order), the driver can be converted to regular module_platform_driver.

---
 drivers/clk/clk-s2mps11.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/clk/clk-s2mps11.c +1 -12
index 2ce370c804aa..aa21371f9104 100644
@@ -267,18 +267,7 @@ static struct platform_driver s2mps11_clk_driver = {
 	.remove = s2mps11_clk_remove,
 	.id_table = s2mps11_clk_id,
 };
-
-static int __init s2mps11_clk_init(void)
-{
-	return platform_driver_register(&s2mps11_clk_driver);
-}
-subsys_initcall(s2mps11_clk_init);
-
-static void __exit s2mps11_clk_cleanup(void)
-{
-	platform_driver_unregister(&s2mps11_clk_driver);
-}
-module_exit(s2mps11_clk_cleanup);
+module_platform_driver(s2mps11_clk_driver);
 
 MODULE_DESCRIPTION("S2MPS11 Clock Driver");
 MODULE_AUTHOR("Yadwinder Singh Brar <[email protected]>");
Signature · 1 line
2.17.1
Tested-by on v1 1/1
#1 lore raw

Hi Krzysztof,

Quoted 7 lines · Krzysztof Kozlowski

The driver was using subsys_initcall() because in old times deferred probe was not supported everywhere and specific ordering was needed. Since probe deferral works fine and specific ordering is discouraged (hides dependencies between drivers and couples their boot order), the driver can be converted to regular module_platform_driver.

Quoted 18 lines
---
  drivers/clk/clk-s2mps11.c | 13 +------------
  1 file changed, 1 insertion(+), 12 deletions(-)
drivers/clk/clk-s2mps11.c +0 -6
index 2ce370c804aa..aa21371f9104 100644
@@ -267,18 +267,7 @@ static struct platform_driver s2mps11_clk_driver = {
  	.remove = s2mps11_clk_remove,
  	.id_table = s2mps11_clk_id,
  };
-
-static int __init s2mps11_clk_init(void)
-{
-	return platform_driver_register(&s2mps11_clk_driver);
-}
-subsys_initcall(s2mps11_clk_init);

drivers/clk/clk-s2mps11.c static struct platform_driver s2mps11_clk_driver = { · line 273

Quoted 10 lines
drivers/clk/clk-s2mps11.c +1 -6
-
-static void __exit s2mps11_clk_cleanup(void)
-{
-	platform_driver_unregister(&s2mps11_clk_driver);
-}
-module_exit(s2mps11_clk_cleanup);
+module_platform_driver(s2mps11_clk_driver);
 
  MODULE_DESCRIPTION("S2MPS11 Clock Driver");
  MODULE_AUTHOR("Yadwinder Singh Brar <[email protected]>");

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
maintainer Applied
#2 lore raw
In reply to Krzysztof Kozlowski

Quoting Krzysztof Kozlowski (2020-09-21 13:35:57)

Quoted 8 lines

The driver was using subsys_initcall() because in old times deferred probe was not supported everywhere and specific ordering was needed. Since probe deferral works fine and specific ordering is discouraged (hides dependencies between drivers and couples their boot order), the driver can be converted to regular module_platform_driver.

---

Applied to clk-next