Thread (49 messages) 49 messages, 3 authors, 2020-08-04

Re: [PATCH v6 14/25] coresight: funnel: remove multiple init calls from funnel driver

From: Mike Leach <hidden>
Date: 2020-08-03 17:14:09

On Fri, 31 Jul 2020 at 07:41, Tingwei Zhang [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Mian Yousaf Kaukab <redacted>

Dynamic-funnel uses module_amba_driver to register. Whereas
static-funnel 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 <redacted>
Signed-off-by: Tingwei Zhang <redacted>
---
 .../hwtracing/coresight/coresight-funnel.c    | 30 +++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
index 900690a9f7f0..46b277ed8606 100644
--- a/drivers/hwtracing/coresight/coresight-funnel.c
+++ b/drivers/hwtracing/coresight/coresight-funnel.c
@@ -341,7 +341,6 @@ static struct platform_driver static_funnel_driver = {
                .suppress_bind_attrs = true,
        },
 };
-builtin_platform_driver(static_funnel_driver);

 static int dynamic_funnel_probe(struct amba_device *adev,
                                const struct amba_id *id)
@@ -372,4 +371,31 @@ static struct amba_driver dynamic_funnel_driver = {
        .probe          = dynamic_funnel_probe,
        .id_table       = dynamic_funnel_ids,
 };
-builtin_amba_driver(dynamic_funnel_driver);
+
+static int __init funnel_init(void)
+{
+       int ret;
+
+       ret = platform_driver_register(&static_funnel_driver);
+       if (ret) {
+               pr_info("Error registering platform driver\n");
+               return ret;
+       }
+
+       ret = amba_driver_register(&dynamic_funnel_driver);
+       if (ret) {
+               pr_info("Error registering amba driver\n");
+               platform_driver_unregister(&static_funnel_driver);
+       }
+
+       return ret;
+}
+
+static void __exit funnel_exit(void)
+{
+       platform_driver_unregister(&static_funnel_driver);
+       amba_driver_unregister(&dynamic_funnel_driver);
+}
+
+module_init(funnel_init);
+module_exit(funnel_exit);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Tested by: Mike Leach [off-list ref]


--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help