From: Leo Yan <leo.yan@arm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@arm.com>,
James Clark <james.clark@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Mao Jinlong <quic_jinlmao@quicinc.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Leo Yan <leo.yan@arm.com>
Subject: [PATCH v4 6/8] coresight: Move sink validation into etm_perf_add_symlink_sink()
Date: Mon, 09 Feb 2026 12:44:38 +0000 [thread overview]
Message-ID: <20260209-arm_coresight_refactor_dev_register-v4-6-62d6042f76f7@arm.com> (raw)
In-Reply-To: <20260209-arm_coresight_refactor_dev_register-v4-0-62d6042f76f7@arm.com>
Move the sink device type checks into etm_perf_add_symlink_sink(), and
return -EOPNOTSUPP for unsupported devices. This simplifies the
registration flow to invoke etm_perf_add_symlink_sink() unconditionally.
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
drivers/hwtracing/coresight/coresight-core.c | 23 +++++++++--------------
drivers/hwtracing/coresight/coresight-etm-perf.c | 5 ++++-
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index b3119832725c08a8375a3a55a11b3bda14b8a3e0..c694b4bea3d724464e97a4932ead584d59d8a69a 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1383,21 +1383,16 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
goto out_unlock;
}
- if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
- csdev->type == CORESIGHT_DEV_TYPE_LINKSINK) &&
- sink_ops(csdev)->alloc_buffer) {
- ret = etm_perf_add_symlink_sink(csdev);
+ ret = etm_perf_add_symlink_sink(csdev);
- if (ret) {
- device_unregister(&csdev->dev);
- /*
- * As with the above, all resources are free'd
- * explicitly via coresight_device_release() triggered
- * from put_device(), which is in turn called from
- * function device_unregister().
- */
- goto out_unlock;
- }
+ /*
+ * As with the above, all resources are free'd explicitly via
+ * coresight_device_release() triggered from put_device(), which is in
+ * turn called from function device_unregister().
+ */
+ if (ret && ret != -EOPNOTSUPP) {
+ device_unregister(&csdev->dev);
+ goto out_unlock;
}
/* Device is now registered */
registered = true;
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 3c8a6f795094bc1da9d8b1d0fda8d58640c87489..3b2a62521396dda819011d336982e960a5bd3d0e 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -902,7 +902,10 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev)
if (csdev->type != CORESIGHT_DEV_TYPE_SINK &&
csdev->type != CORESIGHT_DEV_TYPE_LINKSINK)
- return -EINVAL;
+ return -EOPNOTSUPP;
+
+ if (!sink_ops(csdev)->alloc_buffer)
+ return -EOPNOTSUPP;
if (csdev->ea != NULL)
return -EINVAL;
--
2.34.1
next prev parent reply other threads:[~2026-02-09 12:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 12:44 [PATCH v4 0/8] coresight: Fix device registration and unregistration Leo Yan
2026-02-09 12:44 ` [PATCH v4 1/8] coresight: Fix memory leak in coresight_alloc_device_name() Leo Yan
2026-02-09 12:44 ` [PATCH v4 2/8] coresight: Get parent device reference after sink ID map allocation Leo Yan
2026-02-09 12:44 ` [PATCH v4 3/8] coresight: Protect unregistration with mutex Leo Yan
2026-02-09 12:44 ` [PATCH v4 4/8] coresight: Refactor output connection sysfs link cleanup Leo Yan
2026-02-09 12:44 ` [PATCH v4 5/8] coresight: Refactor sysfs connection group cleanup Leo Yan
2026-02-09 12:44 ` Leo Yan [this message]
2026-02-09 12:44 ` [PATCH v4 7/8] coresight: Do not mix success path with failure handling Leo Yan
2026-02-09 12:44 ` [PATCH v4 8/8] coresight: Unify bus unregistration via coresight_unregister() Leo Yan
2026-02-17 14:51 ` James Clark
2026-02-23 13:28 ` [PATCH v4 0/8] coresight: Fix device registration and unregistration Suzuki K Poulose
2026-02-24 11:06 ` Leo Yan
2026-02-24 11:16 ` Suzuki K Poulose
2026-02-25 14:29 ` Suzuki K Poulose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260209-arm_coresight_refactor_dev_register-v4-6-62d6042f76f7@arm.com \
--to=leo.yan@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.clark@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@arm.com \
--cc=quic_jinlmao@quicinc.com \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®