Skip to contentSkip to conversation

mfd: sec: initialize driver via module_platform_driver

PATCH Superseded Krzysztof Kozlowski 2 participants 2 messages Sep 21, 2020 – Sep 22, 2020

Subsystems (3)
lore
Share & tools
lore

Krzysztof Kozlowski

author maintainer
#0 lore raw

PATCH 1/1 mfd: sec: 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/mfd/sec-core.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/mfd/sec-core.c +1 -13
index 95473ff9bb4b..8d55992da19e 100644
@@ -549,19 +549,7 @@ static struct i2c_driver sec_pmic_driver = {
 	.shutdown = sec_pmic_shutdown,
 	.id_table = sec_pmic_id,
 };
-
-static int __init sec_pmic_init(void)
-{
-	return i2c_add_driver(&sec_pmic_driver);
-}
-
-subsys_initcall(sec_pmic_init);
-
-static void __exit sec_pmic_exit(void)
-{
-	i2c_del_driver(&sec_pmic_driver);
-}
-module_exit(sec_pmic_exit);
+module_i2c_driver(sec_pmic_driver);
 
 MODULE_AUTHOR("Sangbeom Kim <[email protected]>");
 MODULE_DESCRIPTION("Core support for the S5M MFD");
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 19 lines
---
  drivers/mfd/sec-core.c | 14 +-------------
  1 file changed, 1 insertion(+), 13 deletions(-)
drivers/mfd/sec-core.c +0 -7
index 95473ff9bb4b..8d55992da19e 100644
@@ -549,19 +549,7 @@ static struct i2c_driver sec_pmic_driver = {
  	.shutdown = sec_pmic_shutdown,
  	.id_table = sec_pmic_id,
  };
-
-static int __init sec_pmic_init(void)
-{
-	return i2c_add_driver(&sec_pmic_driver);
-}
-
-subsys_initcall(sec_pmic_init);

drivers/mfd/sec-core.c static struct i2c_driver sec_pmic_driver = { · line 555

Quoted 10 lines
drivers/mfd/sec-core.c +1 -6
-
-static void __exit sec_pmic_exit(void)
-{
-	i2c_del_driver(&sec_pmic_driver);
-}
-module_exit(sec_pmic_exit);
+module_i2c_driver(sec_pmic_driver);
 
  MODULE_AUTHOR("Sangbeom Kim <[email protected]>");
  MODULE_DESCRIPTION("Core support for the S5M MFD");

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland