]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
coresight: Remove .cpu_id() callback from source ops
authorLeo Yan <leo.yan@arm.com>
Fri, 15 May 2026 20:08:12 +0000 (21:08 +0100)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 18 May 2026 09:18:45 +0000 (10:18 +0100)
The CPU ID can be fetched directly from the coresight_device structure,
so the .cpu_id() callback is no longer needed.

Remove the .cpu_id() callback from source ops and update callers
accordingly.

Tested-by: Jie Gan <jie.gan@oss.qualcomm.com>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20260515-arm_coresight_path_power_management_improvement-v14-5-f88c4a3ecfe9@arm.com
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-etm-perf.c
drivers/hwtracing/coresight/coresight-etm3x-core.c
drivers/hwtracing/coresight/coresight-etm4x-core.c
drivers/hwtracing/coresight/coresight-sysfs.c
include/linux/coresight.h

index ffed314d1313518b1db1e702986edb0dfc6644d3..5c711e5175014d2a7dce1ec544cd6c89f60d3a7a 100644 (file)
@@ -799,7 +799,7 @@ static int _coresight_build_path(struct coresight_device *csdev,
                goto out;
 
        if (coresight_is_percpu_source(csdev) && coresight_is_percpu_sink(sink) &&
-           sink == per_cpu(csdev_sink, source_ops(csdev)->cpu_id(csdev))) {
+           sink == per_cpu(csdev_sink, csdev->cpu)) {
                if (_coresight_build_path(sink, source, sink, path) == 0) {
                        found = true;
                        goto out;
@@ -1026,7 +1026,7 @@ coresight_find_default_sink(struct coresight_device *csdev)
        /* look for a default sink if we have not found for this device */
        if (!csdev->def_sink) {
                if (coresight_is_percpu_source(csdev))
-                       csdev->def_sink = per_cpu(csdev_sink, source_ops(csdev)->cpu_id(csdev));
+                       csdev->def_sink = per_cpu(csdev_sink, csdev->cpu);
                if (!csdev->def_sink)
                        csdev->def_sink = coresight_find_sink(csdev, &depth);
        }
@@ -1764,10 +1764,10 @@ int coresight_etm_get_trace_id(struct coresight_device *csdev, enum cs_mode mode
 {
        int cpu, trace_id;
 
-       if (csdev->type != CORESIGHT_DEV_TYPE_SOURCE || !source_ops(csdev)->cpu_id)
+       if (csdev->type != CORESIGHT_DEV_TYPE_SOURCE)
                return -EINVAL;
 
-       cpu = source_ops(csdev)->cpu_id(csdev);
+       cpu = csdev->cpu;
        switch (mode) {
        case CS_MODE_SYSFS:
                trace_id = coresight_trace_id_get_cpu_id(cpu);
index 89ba7c9a66137007a9f39efb3f04d55e8237eacb..7434f68d448253ed3de5acae45ded50e68ff2dcf 100644 (file)
@@ -825,7 +825,7 @@ static void etm_addr_filters_sync(struct perf_event *event)
 int etm_perf_symlink(struct coresight_device *csdev, bool link)
 {
        char entry[sizeof("cpu9999999")];
-       int ret = 0, cpu = source_ops(csdev)->cpu_id(csdev);
+       int ret = 0, cpu = csdev->cpu;
        struct device *pmu_dev = etm_pmu.dev;
        struct device *cs_dev = &csdev->dev;
 
index eb665db1a37d9970f7f55395c0aa23b98a7f3118..ab47f69e923fb191b48b82367dce465c79b3a93d 100644 (file)
@@ -466,13 +466,6 @@ static void etm_enable_sysfs_smp_call(void *info)
                coresight_set_mode(csdev, CS_MODE_DISABLED);
 }
 
-static int etm_cpu_id(struct coresight_device *csdev)
-{
-       struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
-
-       return drvdata->cpu;
-}
-
 void etm_release_trace_id(struct etm_drvdata *drvdata)
 {
        coresight_trace_id_put_cpu_id(drvdata->cpu);
@@ -684,7 +677,6 @@ static void etm_disable(struct coresight_device *csdev,
 }
 
 static const struct coresight_ops_source etm_source_ops = {
-       .cpu_id         = etm_cpu_id,
        .enable         = etm_enable,
        .disable        = etm_disable,
 };
index 8f270bfc74723f1fc1cead2da1725ab6b50f910e..b7312570a7ae1f0355c01b6f7a54ea2dd8891097 100644 (file)
@@ -231,13 +231,6 @@ static void etm4_cs_unlock(struct etmv4_drvdata *drvdata,
                CS_UNLOCK(csa->base);
 }
 
-static int etm4_cpu_id(struct coresight_device *csdev)
-{
-       struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
-
-       return drvdata->cpu;
-}
-
 void etm4_release_trace_id(struct etmv4_drvdata *drvdata)
 {
        coresight_trace_id_put_cpu_id(drvdata->cpu);
@@ -1205,7 +1198,6 @@ static void etm4_pause_perf(struct coresight_device *csdev)
 }
 
 static const struct coresight_ops_source etm4_source_ops = {
-       .cpu_id         = etm4_cpu_id,
        .enable         = etm4_enable,
        .disable        = etm4_disable,
        .resume_perf    = etm4_resume_perf,
index da6f22b512c92ab0cff5bb239495a1ab6d2a0dbe..905c973e99cea884e242eab460b31544c49378ad 100644 (file)
@@ -232,7 +232,7 @@ int coresight_enable_sysfs(struct coresight_device *csdev)
                 * be a single session per tracer (when working from sysFS)
                 * a per-cpu variable will do just fine.
                 */
-               cpu = source_ops(csdev)->cpu_id(csdev);
+               cpu = csdev->cpu;
                per_cpu(tracer_path, cpu) = path;
                break;
        case CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE:
@@ -284,7 +284,7 @@ void coresight_disable_sysfs(struct coresight_device *csdev)
 
        switch (csdev->subtype.source_subtype) {
        case CORESIGHT_DEV_SUBTYPE_SOURCE_PROC:
-               cpu = source_ops(csdev)->cpu_id(csdev);
+               cpu = csdev->cpu;
                path = per_cpu(tracer_path, cpu);
                per_cpu(tracer_path, cpu) = NULL;
                break;
index 687190ca11ddeaa83193caa3903a480bac3060d1..e9c20ceb9016fa3db256b8c1147c1fd2027b7b0d 100644 (file)
@@ -395,15 +395,12 @@ struct coresight_ops_link {
 /**
  * struct coresight_ops_source - basic operations for a source
  * Operations available for sources.
- * @cpu_id:    returns the value of the CPU number this component
- *             is associated to.
  * @enable:    enables tracing for a source.
  * @disable:   disables tracing for a source.
  * @resume_perf: resumes tracing for a source in perf session.
  * @pause_perf:        pauses tracing for a source in perf session.
  */
 struct coresight_ops_source {
-       int (*cpu_id)(struct coresight_device *csdev);
        int (*enable)(struct coresight_device *csdev, struct perf_event *event,
                      enum cs_mode mode, struct coresight_path *path);
        void (*disable)(struct coresight_device *csdev,