Skip to content

Commit f2ccc7b

Browse files
Tingwei Zhanggregkh
authored andcommitted
coresight: cti: Don't disable ect device if it's not enabled
If associated ect device is not enabled at first place, disable routine should not be called. Add ect_enabled flag to check whether ect device is enabled. Fix the issue in below case. Ect device is not available when associated coresight device enabled and the association is established after coresight device is enabled. Signed-off-by: Mike Leach <mike.leach@linaro.org> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Link: https://lore.kernel.org/r/20200928163513.70169-20-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cab280b commit f2ccc7b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎drivers/hwtracing/coresight/coresight.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,18 @@ coresight_control_assoc_ectdev(struct coresight_device *csdev, bool enable)
244244

245245
if (!ect_csdev)
246246
return 0;
247+
if ((!ect_ops(ect_csdev)->enable) || (!ect_ops(ect_csdev)->disable))
248+
return 0;
247249

248250
if (enable) {
249-
if (ect_ops(ect_csdev)->enable)
250-
ect_ret = ect_ops(ect_csdev)->enable(ect_csdev);
251+
ect_ret = ect_ops(ect_csdev)->enable(ect_csdev);
252+
if (!ect_ret)
253+
csdev->ect_enabled = true;
251254
} else {
252-
if (ect_ops(ect_csdev)->disable)
255+
if (csdev->ect_enabled) {
253256
ect_ret = ect_ops(ect_csdev)->disable(ect_csdev);
257+
csdev->ect_enabled = false;
258+
}
254259
}
255260

256261
/* output warning if ECT enable is preventing trace operation */

‎include/linux/coresight.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ struct coresight_device {
208208
/* sysfs links between components */
209209
int nr_links;
210210
bool has_conns_grp;
211+
bool ect_enabled; /* true only if associated ect device is enabled */
211212
};
212213

213214
/*

0 commit comments

Comments
 (0)