[PATCH v7 10/25] coresight: etm4x: allow etm4x to be built as a module
Suzuki K Poulose
suzuki.poulose at arm.com
Wed Aug 5 07:27:46 EDT 2020
On 08/05/2020 03:54 AM, Tingwei Zhang wrote:
> From: Kim Phillips <kim.phillips at 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 at linaro.org>
> Cc: Leo Yan <leo.yan at linaro.org>
> Cc: Alexander Shishkin <alexander.shishkin at linux.intel.com>
> Cc: Randy Dunlap <rdunlap at infradead.org>
> Cc: Suzuki K Poulose <Suzuki.Poulose at arm.com>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> Cc: Russell King <linux at armlinux.org.uk>
> Signed-off-by: Kim Phillips <kim.phillips at arm.com>
> Signed-off-by: Tingwei Zhang <tingwei at codeaurora.org>
> Tested-by: Mike Leach <mike.leach at 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",
> + .owner = THIS_MODULE,
> .suppress_bind_attrs = true,
> },
> .probe = etm4_probe,
> + .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@codeaurora.org
Otherwise looks good to me.
Suzuki
More information about the linux-arm-kernel
mailing list