On 08/05/2020 03:54 AM, Tingwei Zhang wrote:
From: Kim Phillips kim.phillips@arm.com
Allow to build coresight-etm4x as a module, for ease of development.
- Kconfig becomes a tristate, to allow =m
- append -core to source file name to allow module to be called coresight-etm4x by the Makefile
- add an etm4_remove function, for module unload
- add a MODULE_DEVICE_TABLE for autoloading on boot
Cc: Mathieu Poirier mathieu.poirier@linaro.org Cc: Leo Yan leo.yan@linaro.org Cc: Alexander Shishkin alexander.shishkin@linux.intel.com Cc: Randy Dunlap rdunlap@infradead.org Cc: Suzuki K Poulose Suzuki.Poulose@arm.com Cc: Greg Kroah-Hartman gregkh@linuxfoundation.org Cc: Russell King linux@armlinux.org.uk Signed-off-by: Kim Phillips kim.phillips@arm.com Signed-off-by: Tingwei Zhang tingwei@codeaurora.org Tested-by: Mike Leach mike.leach@linaro.org
+static int __exit etm4_remove(struct amba_device *adev) +{
- struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev);
- etm_perf_symlink(drvdata->csdev, false);
- etmdrvdata[drvdata->cpu] = NULL;
I think we need to explicitly make this change visible to the other observers, to make sure that a PM notifier doesn't end up using the stale per-cpu pointer.
- etm4_pm_clear();
- coresight_unregister(drvdata->csdev);
- return 0;
+}
- static const struct amba_id etm4_ids[] = { CS_AMBA_ID(0x000bb95d), /* Cortex-A53 */ CS_AMBA_ID(0x000bb95e), /* Cortex-A57 */
@@ -1590,12 +1605,21 @@ static const struct amba_id etm4_ids[] = { {}, }; +MODULE_DEVICE_TABLE(amba, etm4_ids);
- static struct amba_driver etm4x_driver = { .drv = { .name = "coresight-etm4x",
.suppress_bind_attrs = true, }, .probe = etm4_probe,.owner = THIS_MODULE,
- .remove = etm4_remove, .id_table = etm4_ids, };
-builtin_amba_driver(etm4x_driver); +module_amba_driver(etm4x_driver);
Please note that this could conflict with the following patch :
https://lkml.kernel.org/r/20200729051310.18436-1-saiprakash.ranjan@codeauror...
Otherwise looks good to me.
Suzuki