On 14/04/18 00:15, Kim Phillips wrote:
Allow to build coresight as modules. This greatly enhances developer efficiency by allowing the development to take place exclusively on the target, and without needing to reboot in between changes.
Kconfig bools become tristates, to allow =m
MODULE_* macros added: Please correct me if I'm wrong:
- assume LICENSE is "GPL v2"
- tried to get as close to original authors for MODULE_AUTHOR
The 'select' Kconfig statements are replaced with 'depends on' clauses, to specify the dependencies between the modules including other fixes, e.g., coresight-stm unconditionally calls stm_register_device, it therefore depends on STM.
use -objs to denote merge object directives in Makefile, adds a coresight-core nomenclature for the base module.
add a coresight_exit() that unregisters the coresight bus, add remove fns for most others.
fix up modules with ID tables for autoloading on boot, add missing __init and __exit attributes
move coresight_vpid_to_pid to an externed, single instance in coresight-core, to be used by all submodules.
Signed-off-by: Kim Phillips kim.phillips@arm.com
diff --git a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c index 043da86b0fe9..a7f486a577b0 100644 --- a/drivers/hwtracing/coresight/coresight-dynamic-replicator.c +++ b/drivers/hwtracing/coresight/coresight-dynamic-replicator.c @@ -167,6 +167,15 @@ static int replicator_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR_OR_ZERO(drvdata->csdev); } +static int __exit replicator_remove(struct amba_device *adev) +{
- struct replicator_state *drvdata = dev_get_drvdata(&adev->dev);
- coresight_unregister(drvdata->csdev);
- return 0;
+}
- #ifdef CONFIG_PM static int replicator_runtime_suspend(struct device *dev) {
@@ -208,6 +217,8 @@ static const struct amba_id replicator_ids[] = { { 0, 0 }, }; +MODULE_DEVICE_TABLE(amba, replicator_ids);
- static struct amba_driver replicator_driver = { .drv = { .name = "coresight-dynamic-replicator",
@@ -215,6 +226,11 @@ static struct amba_driver replicator_driver = { .suppress_bind_attrs = true, }, .probe = replicator_probe,
- .remove = replicator_remove, .id_table = replicator_ids, };
-builtin_amba_driver(replicator_driver); +module_amba_driver(replicator_driver);
+MODULE_AUTHOR("Suzuki K Poulose suzuki.poulose@arm.com");
Kim,
I just renamed the file, didn't author this driver. May be it was Pratik who wrote the original version.
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 0ea04f588de0..553885db2daa 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -437,6 +437,16 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit tmc_remove(struct amba_device *adev) +{
- struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev);
- misc_deregister(&drvdata->miscdev);
- coresight_unregister(drvdata->csdev);
- return 0;
+}
I think we may need to free the "buffer" used by the TMC-ETR if it is lying around to be collected for sysfs mode.
Suzuki