From 641cdbea7635be3a177dbdf81356ccb16f3769e3 Mon Sep 17 00:00:00 2001 From: Sanjay R Mehta Date: Fri, 24 Sep 2021 02:44:24 -0500 Subject: [PATCH 1/2] thunderbolt: Enable retry logic for intra-domain control packets In case of software connection manager, the response packets are lost sometimes within the stipulated time. Hence resending the control packets in such scenario by increasing the retry count TB_CTL_RETRIES value. Signed-off-by: Sanjay R Mehta Signed-off-by: Basavaraj Natikar Signed-off-by: Mika Westerberg --- drivers/thunderbolt/ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index 0fb5e04191e2..4986edfbdf67 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c @@ -17,7 +17,7 @@ #define TB_CTL_RX_PKG_COUNT 10 -#define TB_CTL_RETRIES 1 +#define TB_CTL_RETRIES 4 /** * struct tb_ctl - Thunderbolt control channel From 0a0624a26f9ceb8aae16882d87dc3b12f17f4a49 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 27 Sep 2021 15:16:11 +0200 Subject: [PATCH 2/2] thunderbolt: Fix -Wrestrict warning gcc-11 warns when building with W=1: drivers/thunderbolt/xdomain.c: In function 'modalias_show': drivers/thunderbolt/xdomain.c:733:16: error: 'sprintf' argument 3 overlaps destination object 'buf' [-Werror=restrict] 733 | return sprintf(buf, "%s\n", buf); | ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/thunderbolt/xdomain.c:727:36: note: destination object referenced by 'restrict'-qualified argument 1 was declared here 727 | char *buf) | ~~~~~~^~~ There is no need for the sprintf() here when a strcat() does the same thing. Signed-off-by: Arnd Bergmann Signed-off-by: Mika Westerberg --- drivers/thunderbolt/xdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c index d66ea4d616fd..eff32499610f 100644 --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -730,7 +730,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, /* Full buffer size except new line and null termination */ get_modalias(svc, buf, PAGE_SIZE - 2); - return sprintf(buf, "%s\n", buf); + return strlen(strcat(buf, "\n")); } static DEVICE_ATTR_RO(modalias);