diff mbox series

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

Message ID 20200731064012.8076-15-tingwei@codeaurora.org (mailing list archive)
State New, archived
Headers show
Series coresight: allow to build coresight as modules | expand

Commit Message

Tingwei Zhang July 31, 2020, 6:40 a.m. UTC
From: Mian Yousaf Kaukab <ykaukab@suse.de>

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 <ykaukab@suse.de>
Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
---
 .../hwtracing/coresight/coresight-funnel.c    | 30 +++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

Comments

Mike Leach Aug. 3, 2020, 5:11 p.m. UTC | #1
On Fri, 31 Jul 2020 at 07:41, Tingwei Zhang <tingwei@codeaurora.org> wrote:
>
> From: Mian Yousaf Kaukab <ykaukab@suse.de>
>
> 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 <ykaukab@suse.de>
> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
> ---
>  .../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 <mike.leach@linaro.org>


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

Patch

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);