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: Andreas Noever <andreas.noever@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	Kranthi Kuntala <kranthi.kuntala@intel.com>,
	Rajmohan Mani <rajmohan.mani@intel.com>,
	Mario.Limonciello@dell.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Lukas Wunner <lukas@wunner.de>
Subject: [PATCH 4/6] thunderbolt: Retry USB4 block read operation
Date: Tue, 16 Jun 2020 16:56:15 +0300	[thread overview]
Message-ID: <20200616135617.85752-5-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20200616135617.85752-1-mika.westerberg@linux.intel.com>

Especially when accessing retimers over USB4 sideband operations the
possibility to get read errors seems to be higher so make the
usb4_do_read_data() retry a couple of times if it sees any other error
than -ENODEV (device is gone). We can only do this for read side because
it carries the offset as part of metadata (as opposed to writes).

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/usb4.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/thunderbolt/usb4.c b/drivers/thunderbolt/usb4.c
index 8a83857573df..142c7244bdb1 100644
--- a/drivers/thunderbolt/usb4.c
+++ b/drivers/thunderbolt/usb4.c
@@ -115,11 +115,8 @@ static int usb4_do_read_data(u16 address, void *buf, size_t size,
 
 		ret = read_block(read_block_data, dwaddress, data, dwords);
 		if (ret) {
-			if (ret == -ETIMEDOUT) {
-				if (retries--)
-					continue;
-				ret = -EIO;
-			}
+			if (ret != -ENODEV && retries--)
+				continue;
 			return ret;
 		}
 
-- 
2.27.0.rc2


  parent reply	other threads:[~2020-06-16 13:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 13:56 [PATCH 0/6] thunderbolt: Add retimer NVM upgrade support Mika Westerberg
2020-06-16 13:56 ` [PATCH 1/6] thunderbolt: Add Intel USB-IF ID to the NVM upgrade supported list Mika Westerberg
2020-06-16 13:56 ` [PATCH 2/6] thunderbolt: Split common NVM functionality into a separate file Mika Westerberg
2020-06-16 13:56 ` [PATCH 3/6] thunderbolt: Generalize usb4_switch_do_[read|write]_data() Mika Westerberg
2020-06-16 13:56 ` Mika Westerberg [this message]
2020-06-16 13:56 ` [PATCH 5/6] thunderbolt: Implement USB4 port sideband operations for retimer access Mika Westerberg
2020-06-16 13:56 ` [PATCH 6/6] thunderbolt: Add support for on-board retimers Mika Westerberg
2020-06-30 12:21 ` [PATCH 0/6] thunderbolt: Add retimer NVM upgrade support Mika Westerberg

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=20200616135617.85752-5-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=Mario.Limonciello@dell.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kranthi.kuntala@intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    --cc=rajmohan.mani@intel.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 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.