[PATCH v3 2/2] coresight: etm4x: Refactor returning TS field
Leo Yan
leo.yan at arm.com
Wed May 21 05:54:06 PDT 2025
As TS == 0b00 is a valid value, this commit updates to return the value
directly instead of converting it to -1.
Currently, only the virtual timestamp (0b01) is used, and other modes
are not enabled. Therefore, this change is safe for user space tools.
Signed-off-by: Leo Yan <leo.yan at arm.com>
---
drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
index 8afcc553bb97..653cb4ce17cf 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c
@@ -2315,23 +2315,11 @@ static ssize_t ts_source_show(struct device *dev,
int val;
struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
- if (!has_feat_trf(drvdata)) {
+ if (!has_feat_trf(drvdata))
val = -1;
- goto out;
- }
-
- val = FIELD_GET(TRFCR_EL1_TS_MASK, drvdata->trfcr);
- switch (val) {
- case TRFCR_EL1_TS_VIRTUAL:
- case TRFCR_EL1_TS_GUEST_PHYSICAL:
- case TRFCR_EL1_TS_PHYSICAL:
- break;
- default:
- val = -1;
- break;
- }
+ else
+ val = FIELD_GET(TRFCR_EL1_TS_MASK, drvdata->trfcr);
-out:
return sysfs_emit(buf, "%d\n", val);
}
static DEVICE_ATTR_RO(ts_source);
--
2.34.1
More information about the linux-arm-kernel
mailing list