[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200117144010.11149-4-ykaukab@suse.de>
Date: Fri, 17 Jan 2020 15:39:58 +0100
From: Mian Yousaf Kaukab <ykaukab@...e.de>
To: linux-arm-kernel@...ts.infradead.org, mathieu.poirier@...aro.org
Cc: linux-kernel@...r.kernel.org, paul.gortmaker@...driver.com,
suzuki.poulose@....com, alexander.shishkin@...ux.intel.com,
Mian Yousaf Kaukab <ykaukab@...e.de>
Subject: [PATCH RFC 03/15] coresight: remove multiple init calls from replicator driver
Dynamic-replicator uses module_amba_driver to register. Whereas
static-replicator uses builtin_platform_driver. Combine these init
calls into a single module_init/exit pair in preparation to make the
driver modular.
Signed-off-by: Mian Yousaf Kaukab <ykaukab@...e.de>
---
drivers/hwtracing/coresight/coresight-replicator.c | 30 ++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
index cc14c3696be0..137328a7f27e 100644
--- a/drivers/hwtracing/coresight/coresight-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-replicator.c
@@ -340,7 +340,6 @@ static struct platform_driver static_replicator_driver = {
.suppress_bind_attrs = true,
},
};
-builtin_platform_driver(static_replicator_driver);
static int dynamic_replicator_probe(struct amba_device *adev,
const struct amba_id *id)
@@ -370,7 +369,34 @@ static struct amba_driver dynamic_replicator_driver = {
.probe = dynamic_replicator_probe,
.id_table = dynamic_replicator_ids,
};
-module_amba_driver(dynamic_replicator_driver);
+
+static int __init replicator_init(void)
+{
+ int ret;
+
+ ret = platform_driver_register(&static_replicator_driver);
+ if (ret) {
+ pr_info("Error registering platform driver\n");
+ return ret;
+ }
+
+ ret = amba_driver_register(&dynamic_replicator_driver);
+ if (ret) {
+ pr_info("Error registering amba driver\n");
+ platform_driver_unregister(&static_replicator_driver);
+ }
+
+ return ret;
+}
+
+static void __exit replicator_exit(void)
+{
+ platform_driver_unregister(&static_replicator_driver);
+ amba_driver_unregister(&dynamic_replicator_driver);
+}
+
+module_init(replicator_init);
+module_exit(replicator_exit);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("CoreSight Replicator driver");
--
2.16.4
Powered by blists - more mailing lists