From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: srini@kernel.org
Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH 2/4] slimbus: messaging: check for valid transaction id
Date: Fri, 16 Jul 2021 11:21:21 +0100 [thread overview]
Message-ID: <20210716102123.26861-3-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20210716102123.26861-1-srinivas.kandagatla@linaro.org>
In some usecases transaction ids are dynamically allocated inside
the controller driver after sending the messages which have generic
acknowledge responses. So check for this before refcounting pm_runtime.
Without this we would end up imbalancing runtime pm count by
doing pm_runtime_put() in both slim_do_transfer() and slim_msg_response()
for a single pm_runtime_get() in slim_do_transfer()
Fixes: d3062a210930 ("slimbus: messaging: add slim_alloc/free_txn_tid()")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/slimbus/messaging.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c
index 6097ddc43a35..e5ae26227bdb 100644
--- a/drivers/slimbus/messaging.c
+++ b/drivers/slimbus/messaging.c
@@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
goto slim_xfer_err;
}
}
-
+ /* Initialize tid to invalid value */
+ txn->tid = 0;
need_tid = slim_tid_txn(txn->mt, txn->mc);
if (need_tid) {
@@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
txn->mt, txn->mc, txn->la, ret);
slim_xfer_err:
- if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT)) {
+ if (!clk_pause_msg && (txn->tid == 0 || ret == -ETIMEDOUT)) {
/*
* remove runtime-pm vote if this was TX only, or
* if there was error during this transaction
--
2.21.0
next prev parent reply other threads:[~2021-07-16 10:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 10:21 [PATCH 0/4] slimbus: ngd: fix runtime pm issues Srinivas Kandagatla
2021-07-16 10:21 ` [PATCH 1/4] slimbus: messaging: start transaction ids from 1 instead of zero Srinivas Kandagatla
2021-07-16 10:21 ` Srinivas Kandagatla [this message]
2021-07-16 10:21 ` [PATCH 3/4] slimbus: ngd: set correct device for pm Srinivas Kandagatla
2021-07-16 10:21 ` [PATCH 4/4] slimbus: ngd: reset dma setup during runtime pm Srinivas Kandagatla
2021-08-06 9:16 [PATCH 0/4] slimbus: patches (set 1) for 5.15 Srinivas Kandagatla
2021-08-06 9:16 ` [PATCH 2/4] slimbus: messaging: check for valid transaction id Srinivas Kandagatla
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=20210716102123.26861-3-srinivas.kandagatla@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srini@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).