LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
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 1/4] slimbus: messaging: start transaction ids from 1 instead of zero
Date: Fri, 16 Jul 2021 11:21:20 +0100	[thread overview]
Message-ID: <20210716102123.26861-2-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20210716102123.26861-1-srinivas.kandagatla@linaro.org>

As tid is unsigned its hard to figure out if the tid is valid or
invalid. So Start the transaction ids from 1 instead of zero
so that we could differentiate between a valid tid and invalid tids

This is useful in cases where controller would add a tid for controller
specific transfers.

Fixes: d3062a210930 ("slimbus: messaging: add slim_alloc/free_txn_tid()")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/slimbus/messaging.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c
index f2b5d347d227..6097ddc43a35 100644
--- a/drivers/slimbus/messaging.c
+++ b/drivers/slimbus/messaging.c
@@ -66,7 +66,7 @@ int slim_alloc_txn_tid(struct slim_controller *ctrl, struct slim_msg_txn *txn)
 	int ret = 0;
 
 	spin_lock_irqsave(&ctrl->txn_lock, flags);
-	ret = idr_alloc_cyclic(&ctrl->tid_idr, txn, 0,
+	ret = idr_alloc_cyclic(&ctrl->tid_idr, txn, 1,
 				SLIM_MAX_TIDS, GFP_ATOMIC);
 	if (ret < 0) {
 		spin_unlock_irqrestore(&ctrl->txn_lock, flags);
-- 
2.21.0


  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 ` Srinivas Kandagatla [this message]
2021-07-16 10:21 ` [PATCH 2/4] slimbus: messaging: check for valid transaction id Srinivas Kandagatla
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 1/4] slimbus: messaging: start transaction ids from 1 instead of zero 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-2-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 \
    --subject='Re: [PATCH 1/4] slimbus: messaging: start transaction ids from 1 instead of zero' \
    /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

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).