Skip to contentSkip to conversation

interconnect: Move qcom interconnect drivers to core_initcall

PATCH In review Jordan Crouse 2 participants 5 messages Oct 31, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover interconnect: Move qcom interconnect drivers to core_initcall

Currently all the qcom interconnect drivers initialize at the device_initcall level when they are built-in which is a problem since nearly all the frameworks and leaf drivers in the SoC depend on interconnect in some fashion. While those frameworks and drivers should be properly PROBE_DEFER aware it is in our best interest to try not to defer just because we can. Move all the drivers to core_initcall when built to increase the chance that they will be available when their dependent drivers need them.

I also tossed on a quick cleanup patch to remove unneeded module exit code from the core file since it is always built in.

Regards,
Jordan

Jordan Crouse (2):
interconnect: Move interconnect drivers to core_initcall
interconnect: Remove unused module exit code from core

 drivers/interconnect/core.c         |  7 +------
 drivers/interconnect/qcom/msm8974.c | 14 +++++++++++++-
 drivers/interconnect/qcom/qcs404.c  | 14 +++++++++++++-
 drivers/interconnect/qcom/sdm845.c  | 13 ++++++++++++-
 4 files changed, 39 insertions(+), 9 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 interconnect: Move interconnect drivers to core_initcall

The interconnect drivers are essential to nearly every leaf driver and subcomponent in the SoC. Initialize them at the core_initcall level so that they are available to their dependent drivers when built in.

---

 drivers/interconnect/qcom/msm8974.c | 14 +++++++++++++-
 drivers/interconnect/qcom/qcs404.c  | 14 +++++++++++++-
 drivers/interconnect/qcom/sdm845.c  | 13 ++++++++++++-
 3 files changed, 38 insertions(+), 3 deletions(-)
drivers/interconnect/qcom/msm8974.c +13 -1
index c70ac58..9386d5c 100644
@@ -778,7 +778,19 @@ static struct platform_driver msm8974_noc_driver = {
 		.of_match_table = msm8974_noc_of_match,
 	},
 };
-module_platform_driver(msm8974_noc_driver);
+
+static int __init msm8974_noc_driver_init(void)
+{
+	return platform_driver_register(&msm8974_noc_driver);
+}
+core_initcall(msm8974_noc_driver_init);
+
+static void __exit msm8974_noc_driver_exit(void)
+{
+	platform_driver_unregister(&msm8974_noc_driver);
+}
+module_exit(msm8974_noc_driver_exit);
+
 MODULE_DESCRIPTION("Qualcomm MSM8974 NoC driver");
 MODULE_AUTHOR("Brian Masney <[email protected]>");
 MODULE_LICENSE("GPL v2");
drivers/interconnect/qcom/qcs404.c +13 -1
index b4966d8..7dd3e76 100644
@@ -535,6 +535,18 @@ static struct platform_driver qcs404_noc_driver = {
 		.of_match_table = qcs404_noc_of_match,
 	},
 };
-module_platform_driver(qcs404_noc_driver);
+
+static int __init qcs404_noc_driver_init(void)
+{
+	return platform_driver_register(&qcs404_noc_driver);
+}
+core_initcall(qcs404_noc_driver_init);
+
+static void __exit qcs404_noc_driver_exit(void)
+{
+	platform_driver_unregister(&qcs404_noc_driver);
+}
+module_exit(qcs404_noc_driver_exit);
+
 MODULE_DESCRIPTION("Qualcomm QCS404 NoC driver");
 MODULE_LICENSE("GPL v2");
drivers/interconnect/qcom/sdm845.c +12 -1
index 502a6c2..4dab92a 100644
@@ -892,7 +892,18 @@ static struct platform_driver qnoc_driver = {
 		.of_match_table = qnoc_of_match,
 	},
 };
-module_platform_driver(qnoc_driver);
+
+static int __init qnoc_driver_init(void)
+{
+	return platform_driver_register(&qnoc_driver);
+}
+core_initcall(qnoc_driver_init);
+
+static void __exit qnoc_driver_exit(void)
+{
+	platform_driver_unregister(&qnoc_driver);
+}
+module_exit(qnoc_driver_exit);
 
 MODULE_AUTHOR("David Dai <[email protected]>");
 MODULE_DESCRIPTION("Qualcomm sdm845 NoC driver");
Signature · 1 line
2.7.4
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH v1 1/2] interconnect: Move interconnect drivers to core_initcall

Quoted 5 lines · Jordan Crouse

The interconnect drivers are essential to nearly every leaf driver and subcomponent in the SoC. Initialize them at the core_initcall level so that they are available to their dependent drivers when built in.

Quoted 83 lines

---

 drivers/interconnect/qcom/msm8974.c | 14 +++++++++++++-
 drivers/interconnect/qcom/qcs404.c  | 14 +++++++++++++-
 drivers/interconnect/qcom/sdm845.c  | 13 ++++++++++++-
 3 files changed, 38 insertions(+), 3 deletions(-)
drivers/interconnect/qcom/msm8974.c +13 -1
index c70ac58..9386d5c 100644
@@ -778,7 +778,19 @@ static struct platform_driver msm8974_noc_driver = {
 		.of_match_table = msm8974_noc_of_match,
 	},
 };
-module_platform_driver(msm8974_noc_driver);
+
+static int __init msm8974_noc_driver_init(void)
+{
+	return platform_driver_register(&msm8974_noc_driver);
+}
+core_initcall(msm8974_noc_driver_init);
+
+static void __exit msm8974_noc_driver_exit(void)
+{
+	platform_driver_unregister(&msm8974_noc_driver);
+}
+module_exit(msm8974_noc_driver_exit);
+
 MODULE_DESCRIPTION("Qualcomm MSM8974 NoC driver");
 MODULE_AUTHOR("Brian Masney <[email protected]>");
 MODULE_LICENSE("GPL v2");
drivers/interconnect/qcom/qcs404.c +13 -1
index b4966d8..7dd3e76 100644
@@ -535,6 +535,18 @@ static struct platform_driver qcs404_noc_driver = {
 		.of_match_table = qcs404_noc_of_match,
 	},
 };
-module_platform_driver(qcs404_noc_driver);
+
+static int __init qcs404_noc_driver_init(void)
+{
+	return platform_driver_register(&qcs404_noc_driver);
+}
+core_initcall(qcs404_noc_driver_init);
+
+static void __exit qcs404_noc_driver_exit(void)
+{
+	platform_driver_unregister(&qcs404_noc_driver);
+}
+module_exit(qcs404_noc_driver_exit);
+
 MODULE_DESCRIPTION("Qualcomm QCS404 NoC driver");
 MODULE_LICENSE("GPL v2");
drivers/interconnect/qcom/sdm845.c +12 -1
index 502a6c2..4dab92a 100644
@@ -892,7 +892,18 @@ static struct platform_driver qnoc_driver = {
 		.of_match_table = qnoc_of_match,
 	},
 };
-module_platform_driver(qnoc_driver);
+
+static int __init qnoc_driver_init(void)
+{
+	return platform_driver_register(&qnoc_driver);
+}
+core_initcall(qnoc_driver_init);
+
+static void __exit qnoc_driver_exit(void)
+{
+	platform_driver_unregister(&qnoc_driver);
+}
+module_exit(qnoc_driver_exit);
 
 MODULE_AUTHOR("David Dai <[email protected]>");
 MODULE_DESCRIPTION("Qualcomm sdm845 NoC driver");
Signature · 1 line
2.7.4
#3 lore raw

PATCH 2/2 interconnect: Remove unused module exit code from core

In reply to Jordan Crouse

The interconnect core is currently always built in:

menuconfig INTERCONNECT
bool "On-Chip Interconnect management support"

So remove the module_exit function and symbolically rename module_init to device_initcall to drive home the point.

---

 drivers/interconnect/core.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/interconnect/core.c +1 -6
index c498796..61aba50 100644
@@ -805,12 +805,7 @@ static int __init icc_init(void)
 	return 0;
 }
 
-static void __exit icc_exit(void)
-{
-	debugfs_remove_recursive(icc_debugfs_dir);
-}
-module_init(icc_init);
-module_exit(icc_exit);
+device_initcall(icc_init);
 
 MODULE_AUTHOR("Georgi Djakov <[email protected]>");
 MODULE_DESCRIPTION("Interconnect Driver Core");
Signature · 1 line
2.7.4
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH v1 2/2] interconnect: Remove unused module exit code from core

Quoted 9 lines · Jordan Crouse

The interconnect core is currently always built in:

menuconfig INTERCONNECT
bool "On-Chip Interconnect management support"

So remove the module_exit function and symbolically rename module_init to device_initcall to drive home the point.

Quoted 26 lines

---

 drivers/interconnect/core.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/interconnect/core.c +1 -6
index c498796..61aba50 100644
@@ -805,12 +805,7 @@ static int __init icc_init(void)
 	return 0;
 }
 
-static void __exit icc_exit(void)
-{
-	debugfs_remove_recursive(icc_debugfs_dir);
-}
-module_init(icc_init);
-module_exit(icc_exit);
+device_initcall(icc_init);
 
 MODULE_AUTHOR("Georgi Djakov <[email protected]>");
 MODULE_DESCRIPTION("Interconnect Driver Core");
Signature · 1 line
2.7.4