From: James Clark <james.clark@arm.com>
To: coresight@lists.linaro.org, suzuki.poulose@arm.com
Cc: James Clark <james.clark@arm.com>,
Mike Leach <mike.leach@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com
Subject: [PATCH 3/8] coresight: Remove ops callback checks
Date: Tue, 12 Dec 2023 15:54:00 +0000 [thread overview]
Message-ID: <20231212155407.1429121-4-james.clark@arm.com> (raw)
In-Reply-To: <20231212155407.1429121-1-james.clark@arm.com>
The check for the existence of callbacks before using them implies that
this happens and is supported. There are no devices without
enable/disable callbacks, and it wouldn't be possible to add a new
working device without adding them either, so just remove them.
Furthermore, there are more callbacks than just enable and disable that
are already used unguarded in other places.
The comment about new session compatibility doesn't seem to match up to
the line of code that it's on so remove it. I think it's alluding to the
fact that sinks will check if they were already enabled via sysfs or
Perf and fail the enable. But there are more detailed comments at those
places, and this one isn't very useful.
Signed-off-by: James Clark <james.clark@arm.com>
---
drivers/hwtracing/coresight/coresight-core.c | 51 +++++---------------
1 file changed, 12 insertions(+), 39 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index f79aa9ff9b64..ab226441e5f4 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -279,16 +279,8 @@ EXPORT_SYMBOL_GPL(coresight_add_helper);
static int coresight_enable_sink(struct coresight_device *csdev,
enum cs_mode mode, void *data)
{
- int ret;
-
- /*
- * We need to make sure the "new" session is compatible with the
- * existing "mode" of operation.
- */
- if (!sink_ops(csdev)->enable)
- return -EINVAL;
+ int ret = sink_ops(csdev)->enable(csdev, mode, data);
- ret = sink_ops(csdev)->enable(csdev, mode, data);
if (ret)
return ret;
@@ -299,12 +291,7 @@ static int coresight_enable_sink(struct coresight_device *csdev,
static void coresight_disable_sink(struct coresight_device *csdev)
{
- int ret;
-
- if (!sink_ops(csdev)->disable)
- return;
-
- ret = sink_ops(csdev)->disable(csdev);
+ int ret = sink_ops(csdev)->disable(csdev);
if (ret)
return;
csdev->enable = false;
@@ -330,11 +317,9 @@ static int coresight_enable_link(struct coresight_device *csdev,
if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_SPLIT && IS_ERR(outconn))
return PTR_ERR(outconn);
- if (link_ops(csdev)->enable) {
- ret = link_ops(csdev)->enable(csdev, inconn, outconn);
- if (!ret)
- csdev->enable = true;
- }
+ ret = link_ops(csdev)->enable(csdev, inconn, outconn);
+ if (!ret)
+ csdev->enable = true;
return ret;
}
@@ -354,9 +339,7 @@ static void coresight_disable_link(struct coresight_device *csdev,
outconn = coresight_find_out_connection(csdev, child);
link_subtype = csdev->subtype.link_subtype;
- if (link_ops(csdev)->disable) {
- link_ops(csdev)->disable(csdev, inconn, outconn);
- }
+ link_ops(csdev)->disable(csdev, inconn, outconn);
if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) {
for (i = 0; i < csdev->pdata->nr_inconns; i++)
@@ -382,11 +365,9 @@ int coresight_enable_source(struct coresight_device *csdev, enum cs_mode mode,
int ret;
if (!csdev->enable) {
- if (source_ops(csdev)->enable) {
- ret = source_ops(csdev)->enable(csdev, data, mode);
- if (ret)
- return ret;
- }
+ ret = source_ops(csdev)->enable(csdev, data, mode);
+ if (ret)
+ return ret;
csdev->enable = true;
}
@@ -404,11 +385,8 @@ static bool coresight_is_helper(struct coresight_device *csdev)
static int coresight_enable_helper(struct coresight_device *csdev,
enum cs_mode mode, void *data)
{
- int ret;
+ int ret = helper_ops(csdev)->enable(csdev, mode, data);
- if (!helper_ops(csdev)->enable)
- return 0;
- ret = helper_ops(csdev)->enable(csdev, mode, data);
if (ret)
return ret;
@@ -418,12 +396,8 @@ static int coresight_enable_helper(struct coresight_device *csdev,
static void coresight_disable_helper(struct coresight_device *csdev)
{
- int ret;
-
- if (!helper_ops(csdev)->disable)
- return;
+ int ret = helper_ops(csdev)->disable(csdev, NULL);
- ret = helper_ops(csdev)->disable(csdev, NULL);
if (ret)
return;
csdev->enable = false;
@@ -453,8 +427,7 @@ static void coresight_disable_helpers(struct coresight_device *csdev)
*/
void coresight_disable_source(struct coresight_device *csdev, void *data)
{
- if (source_ops(csdev)->disable)
- source_ops(csdev)->disable(csdev, data);
+ source_ops(csdev)->disable(csdev, data);
coresight_disable_helpers(csdev);
}
EXPORT_SYMBOL_GPL(coresight_disable_source);
--
2.34.1
next prev parent reply other threads:[~2023-12-12 15:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 15:53 [PATCH 0/8] coresight: Separate sysfs and Perf usage and some other cleanups James Clark
2023-12-12 15:53 ` [PATCH 1/8] coresight: Fix issue where a source device's helpers aren't disabled James Clark
2023-12-12 17:44 ` Suzuki K Poulose
2023-12-13 13:54 ` James Clark
2023-12-13 16:28 ` Suzuki K Poulose
2023-12-12 15:53 ` [PATCH 2/8] coresight: Make language around "activated" sinks consistent James Clark
2024-01-08 11:21 ` Suzuki K Poulose
2024-01-24 11:10 ` James Clark
2023-12-12 15:54 ` James Clark [this message]
2023-12-12 15:54 ` [PATCH 4/8] coresight: Move mode to struct coresight_device James Clark
2024-01-08 11:32 ` Suzuki K Poulose
2023-12-12 15:54 ` [PATCH 5/8] coresight: Remove the 'enable' field James Clark
2024-01-08 14:42 ` Suzuki K Poulose
2024-01-19 9:59 ` James Clark
2024-01-19 10:07 ` Suzuki K Poulose
2023-12-12 15:54 ` [PATCH 6/8] coresight: Move all sysfs code to sysfs file James Clark
2024-01-09 10:22 ` Suzuki K Poulose
2023-12-12 15:54 ` [PATCH 7/8] coresight: Remove atomic type from refcnt James Clark
2023-12-12 15:54 ` [PATCH 8/8] coresight: Remove unused stubs James Clark
2024-01-09 10:38 ` Suzuki K Poulose
2024-01-09 16:48 ` James Clark
2024-01-10 14:00 ` 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=20231212155407.1429121-4-james.clark@arm.com \
--to=james.clark@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexandre.torgue@foss.st.com \
--cc=coresight@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mike.leach@linaro.org \
--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®