All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>,
	Lukas Wunner <lukas@wunner.de>,
	Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH 2/2] thunderbolt: Return -ETIMEDOUT if XDomain peer returns ERROR_NOT_READY
Date: Wed, 11 Nov 2026 13:32:48 +0100	[thread overview]
Message-ID: <20261111123248.1312997-2-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20261111123248.1312997-1-mika.westerberg@linux.intel.com>

The XDomain protocol retries the message when it gets -EAGAIN from the
handler. However, this also happens if the remote peer replies with
ERROR_NOT_READY as tb_xdp_handle_error() also returns -EAGAIN. This can
lead to infinite retry loop. Fix this by returning -ETIMEDOUT in that
case.

Cc: stable@vger.kernel.org
Fixes: 8e1de7042596 ("thunderbolt: Add support for XDomain lane bonding")
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/xdomain.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
index 45e26833c953..e5a962537920 100644
--- a/drivers/thunderbolt/xdomain.c
+++ b/drivers/thunderbolt/xdomain.c
@@ -1370,7 +1370,7 @@ static int tb_xdomain_get_uuid(struct tb_xdomain *xd)
 			return -EAGAIN;
 		}
 		dev_dbg(&xd->dev, "failed to read remote UUID\n");
-		return ret;
+		return ret != -EAGAIN ? ret : -ETIMEDOUT;
 	}
 
 	dev_dbg(&xd->dev, "got remote UUID %pUb\n", &uuid);
@@ -1425,7 +1425,7 @@ static int tb_xdomain_get_link_status(struct tb_xdomain *xd)
 			return -EAGAIN;
 		}
 		dev_dbg(&xd->dev, "failed to receive remote link status\n");
-		return ret;
+		return ret != -EAGAIN ? ret : -ETIMEDOUT;
 	}
 
 	dev_dbg(&xd->dev, "remote link supports width %#x speed %#x\n", slw, sls);
@@ -1472,7 +1472,7 @@ static int tb_xdomain_link_state_change(struct tb_xdomain *xd,
 			return -EAGAIN;
 		}
 		dev_err(&xd->dev, "failed request link state change, aborting\n");
-		return ret;
+		return ret != -EAGAIN ? ret : -ETIMEDOUT;
 	}
 
 	dev_dbg(&xd->dev, "received link state change response\n");
@@ -1564,7 +1564,7 @@ static int tb_xdomain_get_properties(struct tb_xdomain *xd)
 		dev_err(&xd->dev, "failed read XDomain properties from %pUb\n",
 			xd->remote_uuid);
 
-		return ret;
+		return ret != -EAGAIN ? ret : -ETIMEDOUT;
 	}
 
 	mutex_lock(&xd->lock);
-- 
2.50.1


  reply	other threads:[~2026-11-11 12:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 12:32 [PATCH 1/2] thunderbolt: debugfs: Use DEBUGFS_MODE with path config space access Mika Westerberg
2026-11-11 12:32 ` Mika Westerberg [this message]
2026-11-11 12:45   ` [PATCH 2/2] thunderbolt: Return -ETIMEDOUT if XDomain peer returns ERROR_NOT_READY sashiko-bot
2026-11-11 12:42 ` [PATCH 1/2] thunderbolt: debugfs: Use DEBUGFS_MODE with path config space access sashiko-bot

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=20261111123248.1312997-2-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    /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.