Skip to content

Commit a114dbe

Browse files
Tingwei Zhanggregkh
authored andcommitted
coresight: catu: Allow catu drivers to be built as modules
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 Reviewed-by: Mike Leach <mike.leach@linaro.org> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20200928163513.70169-24-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 66af416 commit a114dbe

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎drivers/hwtracing/coresight/Kconfig‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ config CORESIGHT_LINK_AND_SINK_TMC
4242
module will be called coresight-tmc.
4343

4444
config CORESIGHT_CATU
45-
bool "Coresight Address Translation Unit (CATU) driver"
45+
tristate "Coresight Address Translation Unit (CATU) driver"
4646
depends on CORESIGHT_LINK_AND_SINK_TMC
4747
help
4848
Enable support for the Coresight Address Translation Unit (CATU).
@@ -52,6 +52,9 @@ config CORESIGHT_CATU
5252
by looking up the provided table. CATU can also be used in pass-through
5353
mode where the address is not translated.
5454

55+
To compile this driver as a module, choose M here: the
56+
module will be called coresight-catu.
57+
5558
config CORESIGHT_SINK_TPIU
5659
tristate "Coresight generic TPIU driver"
5760
depends on CORESIGHT_LINKS_AND_SINKS

‎drivers/hwtracing/coresight/coresight-catu.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,18 +567,29 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id)
567567
return ret;
568568
}
569569

570+
static int __exit catu_remove(struct amba_device *adev)
571+
{
572+
struct catu_drvdata *drvdata = dev_get_drvdata(&adev->dev);
573+
574+
coresight_unregister(drvdata->csdev);
575+
return 0;
576+
}
577+
570578
static struct amba_id catu_ids[] = {
571579
CS_AMBA_ID(0x000bb9ee),
572580
{},
573581
};
574582

583+
MODULE_DEVICE_TABLE(amba, catu_ids);
584+
575585
static struct amba_driver catu_driver = {
576586
.drv = {
577587
.name = "coresight-catu",
578588
.owner = THIS_MODULE,
579589
.suppress_bind_attrs = true,
580590
},
581591
.probe = catu_probe,
592+
.remove = catu_remove,
582593
.id_table = catu_ids,
583594
};
584595

@@ -601,3 +612,7 @@ static void __exit catu_exit(void)
601612

602613
module_init(catu_init);
603614
module_exit(catu_exit);
615+
616+
MODULE_AUTHOR("Suzuki K Poulose <suzuki.poulose@arm.com>");
617+
MODULE_DESCRIPTION("Arm CoreSight Address Translation Unit (CATU) Driver");
618+
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)