coresight: Fix CTI module refcount leak by making it a helper device
authorJames Clark <james.clark@arm.com>
Tue, 25 Apr 2023 14:35:40 +0000 (15:35 +0100)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 5 Jun 2023 14:46:47 +0000 (15:46 +0100)
commit1b5b1646e63d5ce43469e00680b8c1a3a1e034cd
tree76873ae39450e4d52bef56f1524e612bf97b87eb
parent6148652807ba89b0c9af05ebed3e005b626f90eb
coresight: Fix CTI module refcount leak by making it a helper device

The CTI module has some hard coded refcounting code that has a leak.
For example running perf and then trying to unload it fails:

  perf record -e cs_etm// -a -- ls
  rmmod coresight_cti

  rmmod: ERROR: Module coresight_cti is in use

The coresight core already handles references of devices in use, so by
making CTI a normal helper device, we get working refcounting for free.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-14-james.clark@arm.com
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-cti-core.c
drivers/hwtracing/coresight/coresight-cti-sysfs.c
drivers/hwtracing/coresight/coresight-cti.h
drivers/hwtracing/coresight/coresight-priv.h
drivers/hwtracing/coresight/coresight-sysfs.c
include/linux/coresight.h