Control links and helpers on an activated path during CPU idle. Since coresight_disable_path_from() does not handle a source device's helpers, explicitly disable them alongside the source device.
Signed-off-by: Leo Yan leo.yan@arm.com --- drivers/hwtracing/coresight/coresight-core.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index 6c12692efb51c63f3aa9da6f65a349eae1926f4d..73be22c8f315525111f2dafd692e61bc6db85c25 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1661,11 +1661,31 @@ static bool coresight_pm_is_needed(struct coresight_device *csdev)
static int coresight_pm_save(struct coresight_device *csdev) { - return coresight_ops(csdev)->pm_save_disable(csdev); + int ret; + + if (WARN_ON(!csdev->path)) + return -EINVAL; + + ret = coresight_ops(csdev)->pm_save_disable(csdev); + if (ret) + return ret; + + coresight_disable_helpers(csdev, NULL); + coresight_disable_path_from(csdev->path, NULL, true); + return 0; }
static void coresight_pm_restore(struct coresight_device *csdev) { + if (WARN_ON(!csdev->path)) + return; + + /* + * During CPU idle, the sink device is not accessed, so it is okay to + * pass a NULL pointer for the 'sink_data' parameter. + */ + coresight_enable_path_internal(csdev->path, coresight_get_mode(csdev), + NULL, true); coresight_ops(csdev)->pm_restore_enable(csdev); }