All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	stable@vger.kernel.org
Subject: [PATCH 2/4] slimbus: messaging: check for valid transaction id
Date: Fri,  6 Aug 2021 10:16:37 +0100	[thread overview]
Message-ID: <20210806091639.532-3-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20210806091639.532-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()")
Cc: <stable@vger.kernel.org>
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


  parent reply	other threads:[~2021-08-06  9:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06  9:16 [PATCH 0/4] slimbus: patches (set 1) for 5.15 Srinivas Kandagatla
2021-08-06  9:16 ` [PATCH 1/4] slimbus: messaging: start transaction ids from 1 instead of zero Srinivas Kandagatla
2021-08-06  9:16 ` Srinivas Kandagatla [this message]
2021-08-06  9:16 ` [PATCH 3/4] slimbus: ngd: set correct device for pm Srinivas Kandagatla
2021-08-06  9:16 ` [PATCH 4/4] slimbus: ngd: reset dma setup during runtime pm Srinivas Kandagatla
2021-08-06 13:20 ` [PATCH 0/4] slimbus: patches (set 1) for 5.15 Greg KH
2021-08-07 10:48   ` Srinivas Kandagatla
2021-08-07 13:01     ` Greg KH
2021-08-07 13:04       ` Srinivas Kandagatla
2021-08-07 13:08         ` Greg KH
2021-08-07 13:26           ` Srinivas Kandagatla
2021-08-07 14:16             ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2021-07-16 10:21 [PATCH 0/4] slimbus: ngd: fix runtime pm issues Srinivas Kandagatla
2021-07-16 10:21 ` [PATCH 2/4] slimbus: messaging: check for valid transaction id Srinivas Kandagatla
2021-07-16 10:21   ` 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=20210806091639.532-3-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.