[PATCH v7 13/25] coresight: tmc: allow tmc to be built as a module

Suzuki K Poulose suzuki.poulose at arm.com
Wed Aug 5 11:49:43 EDT 2020


On 08/05/2020 03:54 AM, Tingwei Zhang wrote:
> From: Kim Phillips <kim.phillips at arm.com>
> 
> Allow to build coresight-tmc 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-tmc by the Makefile
> - add an tmc_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>
> ---
>   drivers/hwtracing/coresight/Kconfig           |  6 +++++-
>   drivers/hwtracing/coresight/Makefile          |  6 +++---
>   .../{coresight-tmc.c => coresight-tmc-core.c} | 19 ++++++++++++++++++-
>   3 files changed, 26 insertions(+), 5 deletions(-)
>   rename drivers/hwtracing/coresight/{coresight-tmc.c => coresight-tmc-core.c} (96%)


> diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
> similarity index 96%
> rename from drivers/hwtracing/coresight/coresight-tmc.c
> rename to drivers/hwtracing/coresight/coresight-tmc-core.c
> index 7040d583bed9..29d191ba7ccf 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
> @@ -561,6 +561,16 @@ static void tmc_shutdown(struct amba_device *adev)
>   	spin_unlock_irqrestore(&drvdata->spinlock, flags);
>   }
>   
> +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);

Same comment as the etb10 driver. Will check this out.

Suzuki




More information about the linux-arm-kernel mailing list