Message ID | 20200807111153.7784-24-tingwei@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | coresight: allow to build coresight as modules | expand |
On Fri, Aug 07, 2020 at 07:11:52PM +0800, Tingwei Zhang wrote: > Allow to build coresight-catu as modules, for ease of development. > - Kconfig becomes a tristate, to allow =m > - add catu_remove functions, for module unload > - add a MODULE_DEVICE_TABLE for autoloading on boot > > Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org> > Reviewed-by: Mike Leach <mike.leach@linaro.org> > Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> For patches 22 and 23: Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> > --- > drivers/hwtracing/coresight/Kconfig | 5 ++++- > drivers/hwtracing/coresight/coresight-catu.c | 15 +++++++++++++++ > 2 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig > index b04aae2ceecc..dfe407cde262 100644 > --- a/drivers/hwtracing/coresight/Kconfig > +++ b/drivers/hwtracing/coresight/Kconfig > @@ -42,7 +42,7 @@ config CORESIGHT_LINK_AND_SINK_TMC > module will be called coresight-tmc. > > config CORESIGHT_CATU > - bool "Coresight Address Translation Unit (CATU) driver" > + tristate "Coresight Address Translation Unit (CATU) driver" > depends on CORESIGHT_LINK_AND_SINK_TMC > help > Enable support for the Coresight Address Translation Unit (CATU). > @@ -52,6 +52,9 @@ config CORESIGHT_CATU > by looking up the provided table. CATU can also be used in pass-through > mode where the address is not translated. > > + To compile this driver as a module, choose M here: the > + module will be called coresight-catu. > + > config CORESIGHT_SINK_TPIU > tristate "Coresight generic TPIU driver" > depends on CORESIGHT_LINKS_AND_SINKS > diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c > index 47696a7d24a7..99430f6cf5a5 100644 > --- a/drivers/hwtracing/coresight/coresight-catu.c > +++ b/drivers/hwtracing/coresight/coresight-catu.c > @@ -567,11 +567,21 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) > return ret; > } > > +static int __exit catu_remove(struct amba_device *adev) > +{ > + struct catu_drvdata *drvdata = dev_get_drvdata(&adev->dev); > + > + coresight_unregister(drvdata->csdev); > + return 0; > +} > + > static struct amba_id catu_ids[] = { > CS_AMBA_ID(0x000bb9ee), > {}, > }; > > +MODULE_DEVICE_TABLE(amba, catu_ids); > + > static struct amba_driver catu_driver = { > .drv = { > .name = "coresight-catu", > @@ -579,6 +589,7 @@ static struct amba_driver catu_driver = { > .suppress_bind_attrs = true, > }, > .probe = catu_probe, > + .remove = catu_remove, > .id_table = catu_ids, > }; > > @@ -601,3 +612,7 @@ static void __exit catu_exit(void) > > module_init(catu_init); > module_exit(catu_exit); > + > +MODULE_AUTHOR("Suzuki K Poulose <suzuki.poulose@arm.com>"); > +MODULE_DESCRIPTION("Arm CoreSight Address Translation Unit (CATU) Driver"); > +MODULE_LICENSE("GPL v2"); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >
diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index b04aae2ceecc..dfe407cde262 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -42,7 +42,7 @@ config CORESIGHT_LINK_AND_SINK_TMC module will be called coresight-tmc. config CORESIGHT_CATU - bool "Coresight Address Translation Unit (CATU) driver" + tristate "Coresight Address Translation Unit (CATU) driver" depends on CORESIGHT_LINK_AND_SINK_TMC help Enable support for the Coresight Address Translation Unit (CATU). @@ -52,6 +52,9 @@ config CORESIGHT_CATU by looking up the provided table. CATU can also be used in pass-through mode where the address is not translated. + To compile this driver as a module, choose M here: the + module will be called coresight-catu. + config CORESIGHT_SINK_TPIU tristate "Coresight generic TPIU driver" depends on CORESIGHT_LINKS_AND_SINKS diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 47696a7d24a7..99430f6cf5a5 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -567,11 +567,21 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit catu_remove(struct amba_device *adev) +{ + struct catu_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + return 0; +} + static struct amba_id catu_ids[] = { CS_AMBA_ID(0x000bb9ee), {}, }; +MODULE_DEVICE_TABLE(amba, catu_ids); + static struct amba_driver catu_driver = { .drv = { .name = "coresight-catu", @@ -579,6 +589,7 @@ static struct amba_driver catu_driver = { .suppress_bind_attrs = true, }, .probe = catu_probe, + .remove = catu_remove, .id_table = catu_ids, }; @@ -601,3 +612,7 @@ static void __exit catu_exit(void) module_init(catu_init); module_exit(catu_exit); + +MODULE_AUTHOR("Suzuki K Poulose <suzuki.poulose@arm.com>"); +MODULE_DESCRIPTION("Arm CoreSight Address Translation Unit (CATU) Driver"); +MODULE_LICENSE("GPL v2");