Message ID | 20200731064012.8076-16-tingwei@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | coresight: allow to build coresight as modules | expand |
On Fri, 31 Jul 2020 at 07:41, Tingwei Zhang <tingwei@codeaurora.org> wrote: > > From: Mian Yousaf Kaukab <ykaukab@suse.de> > > 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@suse.de> > Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org> > --- > .../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 78acf29c49ca..6b30bcee7458 100644 > --- a/drivers/hwtracing/coresight/coresight-replicator.c > +++ b/drivers/hwtracing/coresight/coresight-replicator.c > @@ -360,7 +360,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) > @@ -383,4 +382,31 @@ static struct amba_driver dynamic_replicator_driver = { > .probe = dynamic_replicator_probe, > .id_table = dynamic_replicator_ids, > }; > -builtin_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); > -- > 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 --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 78acf29c49ca..6b30bcee7458 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -360,7 +360,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) @@ -383,4 +382,31 @@ static struct amba_driver dynamic_replicator_driver = { .probe = dynamic_replicator_probe, .id_table = dynamic_replicator_ids, }; -builtin_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);