From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAC5123A6 for ; Sat, 27 Apr 2024 20:36:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250181; cv=none; b=mBQFWKF5qfiwLlqsZxIo09UNZzJ+vEBd0y+MYrBUSh3sYMVZCL+BI4QpbnYOCTr1/Hrtf0c9GdV7t3qoaZ0A/ppFWzzRfTyc8pk2Y3hqcUQecsh1bAyAI5mKpA5ZW++nxOVJoarLRU8PyOQKb3nXNpMeN5wiVSXV/XEsKCW1Xsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250181; c=relaxed/simple; bh=WrCXJ1CR/Fi/XZH8dRI39xCZyW9nwXbeXRXPF7QQjI0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XNwfuvQm5bLHrOTMN3ShXvROONTaKrEUd0hyZ+cf3T+bE4suINwGcLaAOT+hfOzjvs+KW73JTIacBeJqciQORspf5oclh7/bYdMyRomBW/vTzIzuUsCGK2HfF/63V+y+kX1wHZpx0dvfyzZo9diu7c+5anTjdpVzpUubCHC+fzk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=lY3a4uzf; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="lY3a4uzf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=5CaGINr/VQqkg0HtDZ9KeFK/+9trW1V6dMyw4Bgc270=; b=lY3a4u zfld32wfH4WUL8Fm84yFopCDkgAwUrowvJJrQNd5QaqfufIDme8DSb1wMhKQcBtb KzzyDsm3FGV/G74PQox/1wqS8Hzl74zYDADALvgzSC5cFjos/By4eJu5b5sW90i/ vlxQmRI986OUKIjZelr6xYkJY97E+lFH8nClZRlHCgkZvacWvRBkZp3ZTR2uQE+t LAgq89wrnzqT7Z4M301GBI4QHVEQN8nkructC2lMlwcdmKVpelFjlLqvZASfau9K 5jkn0EsKI8jcPEiqvRSaPGPqwqORgEmZ1bSyPGggq79AGk0tknqdxFu1xM7YBujx 3ud/TAFNGhfIRi8g== Received: (qmail 1781809 invoked from network); 27 Apr 2024 22:36:14 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:14 +0200 X-UD-Smtp-Session: l3s3148p1@YMW1+BkXtI9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Elie Morisse , Shyam Sundar S K , Andi Shyti , linux-kernel@vger.kernel.org Subject: [PATCH 01/15] i2c: amd-mp2-plat: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:53 +0200 Message-ID: <20240427203611.3750-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-amd-mp2-plat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-amd-mp2-plat.c b/drivers/i2c/busses/i2c= -amd-mp2-plat.c index 112fe2bc5662..d3ac1c77a509 100644 --- a/drivers/i2c/busses/i2c-amd-mp2-plat.c +++ b/drivers/i2c/busses/i2c-amd-mp2-plat.c @@ -97,17 +97,17 @@ static void i2c_amd_cmd_completion(struct amd_i2c_commo= n *i2c_common) static int i2c_amd_check_cmd_completion(struct amd_i2c_dev *i2c_dev) { struct amd_i2c_common *i2c_common =3D &i2c_dev->common; - unsigned long timeout; + unsigned long time_left; =20 - timeout =3D wait_for_completion_timeout(&i2c_dev->cmd_complete, - i2c_dev->adap.timeout); + time_left =3D wait_for_completion_timeout(&i2c_dev->cmd_complete, + i2c_dev->adap.timeout); =20 if ((i2c_common->reqcmd =3D=3D i2c_read || i2c_common->reqcmd =3D=3D i2c_write) && i2c_common->msg->len > 32) i2c_amd_dma_unmap(i2c_common); =20 - if (timeout =3D=3D 0) { + if (time_left =3D=3D 0) { amd_mp2_rw_timeout(i2c_common); return -ETIMEDOUT; } --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8578E144D2F for ; Sat, 27 Apr 2024 20:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250180; cv=none; b=cOtoY/uxyyT7rJ1h59xkFB0a8OAEm2xTaFo/VXfYaaTQaGWQzz5NnGeFFzULJYsAMFepigeX58/+k+RklaFe0iUs5GloDsiVpCDfNkVD8vxOmKJrSm3LgVYzlTARgIV+psRZ1PvshuaRPZQhiTYYkjzVb2ujzVIHHrQs2j587tQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250180; c=relaxed/simple; bh=h1YZllPsTaiaLlHfe955GjP37jjK7/WEfEpoM+4afYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aJ9htb0US0aSGfC+aN1gtRswhDQRrcuniHnn5sjT53Fqa1o8+BIoUpxA6hsvpJGu3A2K8QnFzp32qq19W7nCwZVx9ZqNd5IIOxiSwouO/4uhzX+ybYbxzpczhgl+PIzwi2c3eQ7An+klrTz1FcIX6XMbxqy3W/UFQEq3uPCmDiQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=jefq8255; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="jefq8255" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=ZLv8hXeiJlISzozbBZSXzJgescsNzyHh+xzwSX3kxuA=; b=jefq82 55sCtSyVsbvE4qhoIJRG1DsC8Hp+LjOZ9MhXyN/4kndV5BHe2xsXpRwPsggVXrhB lfcl1zRCCW1JxdLc9pIohqFaf8nMK/oSyqbtoXwwl0P3+eYd0Ox/N1BbNlmN1cKa IFfeG1Mi4UKfSM+4FpzqAxW5J1E6yl7MeQpMSwyLofFxDj5UNp++FkGtQgFJtN+x qfn0vMbp7b9dQjsVp7x9HZsNciSFYcaly07YAJyFv4XsdRHHFA5P5d6EZW74AtMw lDtXev+q36Sc7/AokIA5z/QLYTa+0CcUE7xQJcxu2ru6BR2nKbrYXb5h6OcXHF6N lNZGIvO4Rd3u+OVA== Received: (qmail 1781843 invoked from network); 27 Apr 2024 22:36:15 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:15 +0200 X-UD-Smtp-Session: l3s3148p1@Wh/C+BkXuI9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , Baruch Siach , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/15] i2c: digicolor: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:54 +0200 Message-ID: <20240427203611.3750-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang Acked-by: Baruch Siach --- drivers/i2c/busses/i2c-digicolor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-di= gicolor.c index 3462f2bc0fa8..737604ae11fc 100644 --- a/drivers/i2c/busses/i2c-digicolor.c +++ b/drivers/i2c/busses/i2c-digicolor.c @@ -213,7 +213,7 @@ static irqreturn_t dc_i2c_irq(int irq, void *dev_id) static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int fi= rst, int last) { - unsigned long timeout =3D msecs_to_jiffies(TIMEOUT_MS); + unsigned long time_left =3D msecs_to_jiffies(TIMEOUT_MS); unsigned long flags; =20 spin_lock_irqsave(&i2c->lock, flags); @@ -227,9 +227,9 @@ static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i= 2c_msg *msg, int first, dc_i2c_start_msg(i2c, first); spin_unlock_irqrestore(&i2c->lock, flags); =20 - timeout =3D wait_for_completion_timeout(&i2c->done, timeout); + time_left =3D wait_for_completion_timeout(&i2c->done, time_left); dc_i2c_set_irq(i2c, 0); - if (timeout =3D=3D 0) { + if (time_left =3D=3D 0) { i2c->state =3D STATE_IDLE; return -ETIMEDOUT; } --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF2E9147C64 for ; Sat, 27 Apr 2024 20:36:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250185; cv=none; b=VIoNiaHKa5mXyLgWCwxZog3DQxsdcxDnhJBq85jYYH5jNxwJzwAUQadjwoHjMIvKkZfQ1+ptiANFBTxiRxSWaV2U28xdirRyD7kLh+v8aeRtwnEgkr29p+9p3QfV6JBQomkPpZtvwFU45WR0LAvP2C90faOu1I5dx4i6eh3IbSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250185; c=relaxed/simple; bh=5bodQvN8FujH0DNsbxAsErbliMjmBltn92WZuAMz57w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FsvBQf/eZzONiP3UBmwxIZthdCRFpL/Gz2AxYgpwmz2n9YZQ7QhL5nTllINpJHdzGzoPyD3g+qLKS/gmQtGButVWXVhcFwhsyvBGx20Rsgnv95pZPICJacVKFdTFG6tG5CQkYVXGbl9CPo18GJ1tFS/3yL+KoBK4XMWKOzvac6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=fJiHsU0F; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="fJiHsU0F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=2F3yQc5OYq/TjttbywN55Gd7XF7kO1dQ9WqJ4zJk1sI=; b=fJiHsU 0FrDuj2rFjcEbPa/eFwf2/IKpYn2fIMHQmySsrwP8DoakwcW0k8eSgz7Sm7/2pxJ RaPpfO1YZg+tyPq84O8nUBNIUH5VQK+QNGiizJ35zDwL47RUQlonvtZsPOY/UbcA t9ug/su/9zwYFCGRPxLz4gfeH1ITq1viJBYOmVLBKaZukMTsdl93JIaHaSp/I7MV NMMOdwSA++ql2q3tNkY9t9/sfFcleDLqoBLtwmMoHuWbPqfPZzBY4zhJdAHFsrEg B0Or6avYVZKuZci2VOYxuXtqQhj2yDvu3tBDbJ2nv7/d29ElcsmQyGGDaZYi3VId TCIHT6pvTPCDxt1g== Received: (qmail 1781878 invoked from network); 27 Apr 2024 22:36:16 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:16 +0200 X-UD-Smtp-Session: l3s3148p1@bqHO+BkXwo9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/15] i2c: exynos5: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:55 +0200 Message-ID: <20240427203611.3750-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-exynos5.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exyn= os5.c index 385ef9d9e4d4..d8baca9b610c 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -763,7 +763,7 @@ static bool exynos5_i2c_poll_irqs_timeout(struct exynos= 5_i2c *i2c, static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c, struct i2c_msg *msgs, int stop) { - unsigned long timeout; + unsigned long time_left; int ret; =20 i2c->msg =3D msgs; @@ -775,13 +775,13 @@ static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i= 2c, exynos5_i2c_message_start(i2c, stop); =20 if (!i2c->atomic) - timeout =3D wait_for_completion_timeout(&i2c->msg_complete, - EXYNOS5_I2C_TIMEOUT); - else - timeout =3D exynos5_i2c_poll_irqs_timeout(i2c, + time_left =3D wait_for_completion_timeout(&i2c->msg_complete, EXYNOS5_I2C_TIMEOUT); + else + time_left =3D exynos5_i2c_poll_irqs_timeout(i2c, + EXYNOS5_I2C_TIMEOUT); =20 - if (timeout =3D=3D 0) + if (time_left =3D=3D 0) ret =3D -ETIMEDOUT; else ret =3D i2c->state; --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF43B148313 for ; Sat, 27 Apr 2024 20:36:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250185; cv=none; b=G1F/CBQdet/PXyZvLjTDJC0nfWaesrxDCWvCTjk/uDj8nhBe3IuL205KzPQ4HUIBVyNNdh7QJf4vILwl7prfX3rFk47LXUK7uqQpbTpsPlFQIlSgnYuikXrlJFvEAGky7ST0bw9bG+UX1Aoek6l1l1Xs4FPP2dk4lV5ZfR2Bemk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250185; c=relaxed/simple; bh=GA20x9tiztOUcMRH1FpY/DCyyt7eX+luNbboYOEjcPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sC0YSA0GZHPLiQUgE+Ku80ikA+9Uq2QXtTFShZ0t8/1SNwqgdGAz9SuPp1c9jgMkexmAsXbnMFk5u8fuHgWVhPU/0thu4kFxR+0gxA0CLjaZ5K2dx1JTpygvSoADI+05ID5JV8xGF3VWB89RNin0K5iwKzUcbhF/d37LsniqpWg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=HZjJONq+; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="HZjJONq+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=oEViMnEeQh7c6qFI7c71gpMDemDVCP/zHpYArgFPMWA=; b=HZjJON q+9hbgCHYqRSse7kQ9X730Juffrh4t3/5Cy9U7md22+oeBwczkNnmU0iXPnGi089 Xvl/3dfTTfO5krroDEZ30Sqspp0FKDgd/x8R5hw7STXYXYcqtOGQeNiaHAr0rCuO jvxGZrCOS+upr2JzYnRQXhPYqpviGBhTaTJ5nGgksefRayCJgnR+Ib2GHybbIdCq gVLBt73Zp92rrBjPBH3EH3frfXeGUMsdetHun3/0lKsYbbPcNP77wIw794zdiV8g 24tNX1GrN+Z3CSS15TMILkmOHUOEhVYrU93d4BYJ+fUm13uOCQK+ldT2e0HEijTv KyD6zK3GuHdUMO3w== Received: (qmail 1781896 invoked from network); 27 Apr 2024 22:36:17 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:17 +0200 X-UD-Smtp-Session: l3s3148p1@l6Lf+BkXps9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , linux-kernel@vger.kernel.org Subject: [PATCH 04/15] i2c: hix5hd2: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:56 +0200 Message-ID: <20240427203611.3750-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-hix5hd2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5= hd2.c index 8e75515c3ca4..a47b9939fa2c 100644 --- a/drivers/i2c/busses/i2c-hix5hd2.c +++ b/drivers/i2c/busses/i2c-hix5hd2.c @@ -314,7 +314,7 @@ static void hix5hd2_i2c_message_start(struct hix5hd2_i2= c_priv *priv, int stop) static int hix5hd2_i2c_xfer_msg(struct hix5hd2_i2c_priv *priv, struct i2c_msg *msgs, int stop) { - unsigned long timeout; + unsigned long time_left; int ret; =20 priv->msg =3D msgs; @@ -327,9 +327,9 @@ static int hix5hd2_i2c_xfer_msg(struct hix5hd2_i2c_priv= *priv, reinit_completion(&priv->msg_complete); hix5hd2_i2c_message_start(priv, stop); =20 - timeout =3D wait_for_completion_timeout(&priv->msg_complete, - priv->adap.timeout); - if (timeout =3D=3D 0) { + time_left =3D wait_for_completion_timeout(&priv->msg_complete, + priv->adap.timeout); + if (time_left =3D=3D 0) { priv->state =3D HIX5I2C_STAT_RW_ERR; priv->err =3D -ETIMEDOUT; dev_warn(priv->dev, "%s timeout=3D%d\n", --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2961A15534D for ; Sat, 27 Apr 2024 20:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250192; cv=none; b=gtuO62FqYt+JQj1JSRpX2SxDEDZx6kFEeLp9V4mYy13TkGcHwzvgZgaQ1DCzO+ccCgAzhvnQ6vzTsiuNEsnGzAZFVPXcBZMiC5hZF6k+00sZizd8Rwrz/lYnI/BUlx76CwlWLzcPH0DeOIqIGdIeGtiJDh+BGvOlggjTnBmfFes= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250192; c=relaxed/simple; bh=n4hQc5gZqdrk//Rxy2JOXADtiKMOzaMTzzXO1IINnr0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TjQYk2fu+VlWjXInnhzBsaBjbWzRW3tQXfWOqj/I23a4SXZ65c+j2kReR0Th8Bn9S/cqqMXY+bchIebkCKukhv+VdK8x5Jv/asfA0TMp+zrOtoybCy7IfrdN++linBPPwaDilTkaD6nwpTRW136tPVjtgTw8EO9E8GnwZS18XY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=FNRdal9N; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="FNRdal9N" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=lgb5SzZOxsbM5nweq0hf5zFbKk9/34W+E/fPoNu8BgM=; b=FNRdal 9NQ6vzfXBzcTkf+PgQZ1TcO7TXIwlE2qCZcth2/uSaa76PiE6woabAXEq4BcjnQT Ob67SFbg8SmjEONMw50ZZ7Xt+rp4mGVb085+TH7Z3l16ZMe7zWwfmzB+u+64DUtH kAM/2qBP0dK3Ux1E3tPslg+feGkWQetQSDPPwfeZIhZFCbDrstt9amQ+GWS5SdXt e4/rDMN5l3HT5jqJlstfd935xijmv+n9839AYqyD8fOF5UjFNJZChsXrTYyO+lAW buIei5S4w89RfPWb/6BX6n4TOGf1EyhKjGzwllDrAnIk6Zj0vWCdiA97hjNdVcSl 3GBUnGbQ5NLGJOvg== Received: (qmail 1781911 invoked from network); 27 Apr 2024 22:36:18 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:18 +0200 X-UD-Smtp-Session: l3s3148p1@Rr/s+BkXts9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Dong Aisheng , Andi Shyti , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/15] i2c: imx-lpi2c: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:57 +0200 Message-ID: <20240427203611.3750-6-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-imx-lpi2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-im= x-lpi2c.c index 36e8f6196a87..0197786892a2 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -307,11 +307,11 @@ static int lpi2c_imx_master_disable(struct lpi2c_imx_= struct *lpi2c_imx) =20 static int lpi2c_imx_msg_complete(struct lpi2c_imx_struct *lpi2c_imx) { - unsigned long timeout; + unsigned long time_left; =20 - timeout =3D wait_for_completion_timeout(&lpi2c_imx->complete, HZ); + time_left =3D wait_for_completion_timeout(&lpi2c_imx->complete, HZ); =20 - return timeout ? 0 : -ETIMEDOUT; + return time_left ? 0 : -ETIMEDOUT; } =20 static int lpi2c_imx_txfifo_empty(struct lpi2c_imx_struct *lpi2c_imx) --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84421156C61 for ; Sat, 27 Apr 2024 20:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250190; cv=none; b=HtNMihSxNU1RtQ+JIyRumoBLwMjxCcIy3SBghQcJVGbOC5FtMQ1oqwxrbMBBoKf1Vmr3fEjN+4jN8qvRzfZY00iY4cZcnHcOJMkrWRFGo3W60H1eZEi7L0twgNJDI83Lk/sr2ErVORc/dIrosvFGsIpz6Zz5NmzNbUhjtFwLh9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250190; c=relaxed/simple; bh=62a58IoiDwdzg1R5YDL7NnQnvuavWO4JwBPh7wx8jzg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i6RO8pPHBHj6pxOx1964z+GdEcl7kT29kkp57+1b6607xrrSy9d/TBPUkzbLxFZdd421wZJZYF8aR5yl3WuhYkC2CDq6HO83YOZiEBacgS6bCKXMU82vI0V1QCw13O3hdzoTIkSLrc88q9cCcT9uLjzArs6J03c0MNpFE+JEEAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=L3+0fY2u; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="L3+0fY2u" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=jQGvpOTQ/PjbdH5046gFtuRjUEd3lekowRVy2kqHuxw=; b=L3+0fY 2uYQG3EhoYZpe+4Nm3trYbjv5xdSoDowK0mlML3oaSeTLKvLofCRl2QgsHkTCVFL Xi4qIO3vXmbTFZzVktEELXmK4wgzC+DVFgxBX9spvuKpHgRPWJgImPsOTHDEImJl 589uZhyjYbpZKEQm8x3S1YPLTTyh7MDyqQxymNgX3BOFm0AZU51rcPKsNjiAIMyl UzNTvSfoyqpSNkT3qrjAO0pRjk2yJgWbuIdCj687oICRtqjYqmvQvynJi/uY5JKx Xnlw0ZjaINRgGuV0lAkUJq1pQCHSYTZooBG4pW5xZEejR6WwMPXzJPwsbNpzcRLY kihhCbhoroao6qZA== Received: (qmail 1781932 invoked from network); 27 Apr 2024 22:36:19 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:19 +0200 X-UD-Smtp-Session: l3s3148p1@NaD5+BkXws9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Vignesh R , Andi Shyti , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/15] i2c: omap: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:58 +0200 Message-ID: <20240427203611.3750-7-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-omap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 36bebef36740..30a5ea282a8b 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -660,7 +660,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop, bool polling) { struct omap_i2c_dev *omap =3D i2c_get_adapdata(adap); - unsigned long timeout; + unsigned long time_left; u16 w; int ret; =20 @@ -740,18 +740,18 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, * into arbitration and we're currently unable to recover from it. */ if (!polling) { - timeout =3D wait_for_completion_timeout(&omap->cmd_complete, - OMAP_I2C_TIMEOUT); + time_left =3D wait_for_completion_timeout(&omap->cmd_complete, + OMAP_I2C_TIMEOUT); } else { do { omap_i2c_wait(omap); ret =3D omap_i2c_xfer_data(omap); } while (ret =3D=3D -EAGAIN); =20 - timeout =3D !ret; + time_left =3D !ret; } =20 - if (timeout =3D=3D 0) { + if (time_left =3D=3D 0) { omap_i2c_reset(omap); __omap_i2c_init(omap); return -ETIMEDOUT; --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE7AE147C64 for ; Sat, 27 Apr 2024 20:36:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250190; cv=none; b=j3kuQdvmRuEd3qC5Y1N/963d82norSZEcWEyc94ry8Ry0sHlLiCifWMFjsO25SpCwXWSjECp7p294BBHyKAICvhRGGxqxMCcHiTzKrBFwDg8vO7CI+fN0qimQfAJvZOcY9hJ+Lh4L60si4sXA7i5RdLiQ+SOdnOSQw8yLa28Ka0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250190; c=relaxed/simple; bh=ZffgLvLA2ct8aLiK6ss8TTRJQX3H7E7IWykoPfEgyUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tI0mcsxYwNqPcMKovUlPHDSj+n4j/tyHA1ybU9XB4Bkoyc9PqzsJxuqaMlFzQfitmexOkGoonFnjKS/gatA+T2+QJk7uUl+42apk1jj9B0C2nRXIYcsQfonTo622HZtrosuRb3kUxydWrEGNPZ6lqGcFavp2VU4znVqih8JbeEY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=OZ72CkTE; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="OZ72CkTE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=mYFMXe+0a2Lv486QWPuwKd2ikamhuuadZolEfiYMi6k=; b=OZ72Ck TERAhl8Xe2RgegXCDutBZrcxPMoIw3MEFtFWCeljqKZZ0KL05IYHCufNLy1bxihR oEkTS3wbglGUNKN+cDm9gbsVUD/1QPRIMaMg0VRECPwm9nPACERE+JMvIqN3LwiY UJypdqmTeMhUJRcz3JUAW3jeGMqtbhejFbo2LLUu9DU10U05VZFM/UfF8byg3Mx0 5D0Og+34V+qUXGaPiAk5ICTS+yCaifcaQMLaYdhIvJsvdfPdQD1pYdrSILUMatym LTJl1YJKuDoBHhCsPtGIA42wls6Mc66QSqySeWi69XGlec0W+A+DEy59Tz5UuHX0 FiTHl4RGwsw6ycjw== Received: (qmail 1781948 invoked from network); 27 Apr 2024 22:36:20 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:20 +0200 X-UD-Smtp-Session: l3s3148p1@txgG+RkXxM9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Patrice Chotard , Andi Shyti , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/15] i2c: st: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:59 +0200 Message-ID: <20240427203611.3750-8-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang Reviewed-by: Uwe Kleine-K=C3=B6nig --- drivers/i2c/busses/i2c-st.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c index dbb93394ff94..5e01fe3dbb63 100644 --- a/drivers/i2c/busses/i2c-st.c +++ b/drivers/i2c/busses/i2c-st.c @@ -647,7 +647,7 @@ static int st_i2c_xfer_msg(struct st_i2c_dev *i2c_dev, = struct i2c_msg *msg, { struct st_i2c_client *c =3D &i2c_dev->client; u32 ctl, i2c, it; - unsigned long timeout; + unsigned long time_left; int ret; =20 c->addr =3D i2c_8bit_addr_from_msg(msg); @@ -685,11 +685,11 @@ static int st_i2c_xfer_msg(struct st_i2c_dev *i2c_dev= , struct i2c_msg *msg, st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_STRTG); } =20 - timeout =3D wait_for_completion_timeout(&i2c_dev->complete, - i2c_dev->adap.timeout); + time_left =3D wait_for_completion_timeout(&i2c_dev->complete, + i2c_dev->adap.timeout); ret =3D c->result; =20 - if (!timeout) + if (!time_left) ret =3D -ETIMEDOUT; =20 i2c =3D SSC_I2C_STOPG | SSC_I2C_REPSTRTG; --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C128F15991E for ; Sat, 27 Apr 2024 20:36:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250194; cv=none; b=q4nkvUJ7o3cECFLxn2QydKYwqcG64VnGbp95s+J3VWtWPCZQCET8URnNBF+yJfCh2D50npWyH0wuSG7IRpv60Gp2C/PlQOFSDxuti8nvHHAVpiO9TlQhE6fsoMntTHe+I5jemSiAchD/FtrlroNDUEhdRIoClpsXpCSW7k2P3nM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250194; c=relaxed/simple; bh=+MzugzJWD0ePnwNN8kUfm/oNioMUuBkwypU7J8gu1eI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=diTn0jR/4rteTfJ5VKJrirtf8suKGMRRtO3iJF5REheHCzW8LBCqZJ4sDLVonAKhyXXJZ9GQq00VDeiSUt4LR6T0qrtt5jDDegSJZ613qg1wPe7B1VCjHhSIDZudfgO0vNf+b17JekS7C2YTGUFknvakDK3Mzd5VjwOXtPQJHj0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=HseIkXQe; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="HseIkXQe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=gZ01Lhe4pAwdcuNCxaIYgv6RGXpiS5mlcEHdQcrIkWs=; b=HseIkX QeeKpgVS9jKY4BFhE/0UABE1zW0Qtb4VnivHX577i1yOEm/I+47oowrPMH9LHqnb MkwiKA+2NOg+KZwq2G91nlmmV01I+/7mZayTfWuToS6V/yewif7lNRllCbkQTXIj 3lSqVJV6CX4HrrakUN+dmjXfh3gU6Xy+TzgG3pr5sQF8yThqDDl17yCg0mOuET2O gqYIHau5mkauEbFYudMXLFdHwIW9Lbx9Ipej6NRnPPUTGAB4dAlJfoWgWKaioOJ1 gYBEpL6ZHriOdPz8Gfo3FviY/0Jy1BhXWB36135S/GSfv94r8K5x52vqVqCMpivg OVycBaShXiLV6cBg== Received: (qmail 1781964 invoked from network); 27 Apr 2024 22:36:20 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:20 +0200 X-UD-Smtp-Session: l3s3148p1@P+gS+RkX0s9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Pierre-Yves MORDRET , Alain Volmat , Andi Shyti , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/15] i2c: stm32f4: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:00 +0200 Message-ID: <20240427203611.3750-9-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-stm32f4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm3= 2f4.c index 859ac0cf7f6c..f8b12be6ef55 100644 --- a/drivers/i2c/busses/i2c-stm32f4.c +++ b/drivers/i2c/busses/i2c-stm32f4.c @@ -681,7 +681,7 @@ static int stm32f4_i2c_xfer_msg(struct stm32f4_i2c_dev = *i2c_dev, { struct stm32f4_i2c_msg *f4_msg =3D &i2c_dev->msg; void __iomem *reg =3D i2c_dev->base + STM32F4_I2C_CR1; - unsigned long timeout; + unsigned long time_left; u32 mask; int ret; =20 @@ -706,11 +706,11 @@ static int stm32f4_i2c_xfer_msg(struct stm32f4_i2c_de= v *i2c_dev, stm32f4_i2c_set_bits(reg, STM32F4_I2C_CR1_START); } =20 - timeout =3D wait_for_completion_timeout(&i2c_dev->complete, - i2c_dev->adap.timeout); + time_left =3D wait_for_completion_timeout(&i2c_dev->complete, + i2c_dev->adap.timeout); ret =3D f4_msg->result; =20 - if (!timeout) + if (!time_left) ret =3D -ETIMEDOUT; =20 return ret; --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCD6A15887A for ; Sat, 27 Apr 2024 20:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250193; cv=none; b=h1fh5qtzzkZc7JRiFDEEBcleJxiUWM76VCE7nnSLLwpRV4695vqLfy8b13KRBEW67K7HZxJr1rG3xydvrwjgEX91d8jHk3U9vWjCO16ebLLMmm4mkOIun6oXyYHdYdiWBPw5nwGigj0atcBFhI8dx61np+RWVpzp/w7TBsYm4Zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250193; c=relaxed/simple; bh=zMu+yNewBqoDipSU74HvvlkDLWwOVjxUjGnxsnMRywE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S5riy1M7h4422YCXGYsoZASN5g2SuUhFId1mXECEEhWabzpVLqBP+pcPY/Hvl4VSxWoQWC+5BluFbiWJoGkTtucX4pU7b/ZbfAP+2pnaRr5v9IAP/1tXJCxZcgte/VxYXGMdBvL/3t5ddw1JhkdaTHfdOd1EtY52AP2cXtDemyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=gOYqFv1h; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="gOYqFv1h" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=YtBKETUeeWdigupUNh1poF2adUaIr8Z2d3RrJ3sCaV0=; b=gOYqFv 1h+vS8r2Jh7ErStywwggdVCLpThEUHqOT3Pr9Yl8/Bj3LNrIuZKYrWRJs6jd8fpL YWuTmxexa05QoXMra0ELDpsHesZVfBelM2P6CO2Yyg5Ok+eucKHhso1HJf0dKvlN hHyfEibxw7g1vs8jvFH2DyDozOdipgzZ/mt1pALZr5DR0LVz9eS9upzO6KDsmBMa t5qA9bQKCtNvax/YPaPkA5dUsRVckAMvHZTt1uXtldzNryidwLL7hImJnsTIN2Rq 360HMvNXGh0c2uDI22nZaXEW0Mb3okLZhDgA7JIt94wq4J4IdVD7+CoccN57tKA/ hWzfRSZ1Y4sk1qtw== Received: (qmail 1782013 invoked from network); 27 Apr 2024 22:36:21 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:21 +0200 X-UD-Smtp-Session: l3s3148p1@8rwe+RkX2s9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Pierre-Yves MORDRET , Alain Volmat , Andi Shyti , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/15] i2c: stm32f7: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:01 +0200 Message-ID: <20240427203611.3750-10-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-stm32f7.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm3= 2f7.c index 01210452216b..cfee2d9c09de 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -1789,7 +1789,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter = *adapter, u16 addr, struct stm32f7_i2c_msg *f7_msg =3D &i2c_dev->f7_msg; struct stm32_i2c_dma *dma =3D i2c_dev->dma; struct device *dev =3D i2c_dev->dev; - unsigned long timeout; + unsigned long time_left; int i, ret; =20 f7_msg->addr =3D addr; @@ -1809,8 +1809,8 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter = *adapter, u16 addr, if (ret) goto pm_free; =20 - timeout =3D wait_for_completion_timeout(&i2c_dev->complete, - i2c_dev->adap.timeout); + time_left =3D wait_for_completion_timeout(&i2c_dev->complete, + i2c_dev->adap.timeout); ret =3D f7_msg->result; if (ret) { if (i2c_dev->use_dma) @@ -1826,7 +1826,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter = *adapter, u16 addr, goto pm_free; } =20 - if (!timeout) { + if (!time_left) { dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr); if (i2c_dev->use_dma) dmaengine_terminate_sync(dma->chan_using); --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C73515AABF for ; Sat, 27 Apr 2024 20:36:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250195; cv=none; b=ZsoAEY7i6jd3ncLSe+U1zrnIZqxtIYeyYHPAdEc2a0Dg0Wq9rJBrGkQn8kb2kkyTyPMNa/Ui5+ZCURED/2W3KhDuw8daN5fsHx/wV6JUXMGS6rJCfdnVYK2KijqE9FuWU7IrKU81XjLAOCFsUj+jUBJMjcV69/g0Ob/0+DsTAOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250195; c=relaxed/simple; bh=FtVdbC/U+l3sGLK8ZjsebvbxA/VMSsQcdOcx5l5rRRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m3HdBQ8zJ8JjRqd7MjauaI+B9PR3GiwOwu6SgEQi0pJdy7rrwnJiLQMZ2ayYd6iZGkNuymBHoRDNIFqUrulq2YPo9G6ZIPwfXYIjHnzi15wQS2PUIBwvYRClRegAVeG/4ViePYF4/kQMZJIJ0oAQbxVOw/Ao5awmcgoiDI+BQ0U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=KlcFqedh; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="KlcFqedh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=TosNpVR11Gbh2os3Snnrhjp03ukLw8+MsWgLfBAsKaU=; b=KlcFqe dhq+bjZ/SZMwpB56m5o0iNHhDcAfUVEYFwPbIMPH5pvi7snaN65Ktv3yfDxzZA0d JlixcTIoAw9LYijnAKEoTLCShCdJgDnZoLr1yt2cCuP9ZHFobBNdjZmHKLVQDDSZ yn+qTER3IG2YwggPCkykkbJkUP/0eN6Xoyc8LOKBywrBY2eeaIbMIc2YsFOeW7lA jQdySzRISMN+pPJgiSQTX2kI+N/v24cCOrSygJ5CyDqKLBrMEL9bMwQQkCSxvzbD H6TU5CctN4oKOHMxaJWNPXhJeD+eToHiYQbtaNG8CqMqwIiThRQdnFY561GHlAKh ofYGi2phDhiPaG6A== Received: (qmail 1782046 invoked from network); 27 Apr 2024 22:36:22 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:22 +0200 X-UD-Smtp-Session: l3s3148p1@wtIq+RkX4M9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Ard Biesheuvel , Andi Shyti , linux-kernel@vger.kernel.org Subject: [PATCH 10/15] i2c: synquacer: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:02 +0200 Message-ID: <20240427203611.3750-11-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang Acked-by: Ard Biesheuvel --- drivers/i2c/busses/i2c-synquacer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-sy= nquacer.c index bbea521b05dd..bf9bcfefa30e 100644 --- a/drivers/i2c/busses/i2c-synquacer.c +++ b/drivers/i2c/busses/i2c-synquacer.c @@ -311,7 +311,7 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i= 2c, struct i2c_msg *msgs, int num) { unsigned char bsr; - unsigned long timeout; + unsigned long time_left; int ret; =20 synquacer_i2c_hw_init(i2c); @@ -335,9 +335,9 @@ static int synquacer_i2c_doxfer(struct synquacer_i2c *i= 2c, return ret; } =20 - timeout =3D wait_for_completion_timeout(&i2c->completion, - msecs_to_jiffies(i2c->timeout_ms)); - if (timeout =3D=3D 0) { + time_left =3D wait_for_completion_timeout(&i2c->completion, + msecs_to_jiffies(i2c->timeout_ms)); + if (time_left =3D=3D 0) { dev_dbg(i2c->dev, "timeout\n"); return -EAGAIN; } --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C022415AD91 for ; Sat, 27 Apr 2024 20:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250196; cv=none; b=c9iqbTHHYSrZ483sgSl9eLX3WM66oWdmk+ufq6B/0uuLeniXUkcLmDOm0TsTwUzJssAcPdvDQXs3vzgshP9xlCRPHcebX3FHmaOC+oCPcOLMJskXmZjLb1yZWB4vrPg2zOOlTEA4XQTQUtsabged54ny040N7TrlNJE8OjWYCdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250196; c=relaxed/simple; bh=PQbfVr0szfKuLV1vCwfI/knNOPEEk21YgZvjweSPPWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MXv7sYEc+qKcWhYQh9JQCaNP10yhbJfo5XFNfkvvVYZBDh/WLFJXMiVaa7omFM2Bpv2/WUxnHuzWXu/4yO5sorb7J8H80kM0cu0g5nNdxIdVUtcSaM0k+8KZSRIq8p7qYiYcTP5eV7OIwWN2M1Qrp7bXkyK0Wzmnvwhs+XUJ4iE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=YmZgHe7y; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="YmZgHe7y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=J5GXIPR6fCe0wVIwusYLH0113fTOigxkr/KOK1nav1s=; b=YmZgHe 7yYTYd8mRqA590uEXPCeTXuthPUUa4WtfNzpuRFPoBHZ7c46clNLgJo9Mtu8CyZJ G9ejf2k6+RBeMI0l4gW3v8PFLfIKub4w/OHEROYkgSRrsMLFnmSOFVRNhc4tD3KQ mvsCQSnevfR7VFTIzRUfMenKgNSXuz/aAj1kjIIMtDzOi5UlrnWR2jaTpUPXeU5g bkoqo+Y3CZPfhVkioFqoyhr/FimbSUOUqUQG4g7zYzcjSpd9B0mwmQVm9c868Cr7 W860VfecVpB7nIADJWSSMsAgw9j2ebLU5kGu+TAghroFWrtEOsG/XyyD6yddtHR0 FnV5DepsZEsxJVzw== Received: (qmail 1782065 invoked from network); 27 Apr 2024 22:36:23 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:23 +0200 X-UD-Smtp-Session: l3s3148p1@B0g3+RkX6s9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Paul Cercueil , Andi Shyti , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/15] i2c: jz4780: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:03 +0200 Message-ID: <20240427203611.3750-12-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang Acked-by: Paul Cercueil Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- drivers/i2c/busses/i2c-jz4780.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz478= 0.c index 55035cca0ae5..7951891d6b97 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -565,7 +565,7 @@ static inline int jz4780_i2c_xfer_read(struct jz4780_i2= c *i2c, int idx) { int ret =3D 0; - long timeout; + unsigned long time_left; int wait_time =3D JZ4780_I2C_TIMEOUT * (len + 5); unsigned short tmp; unsigned long flags; @@ -600,10 +600,10 @@ static inline int jz4780_i2c_xfer_read(struct jz4780_= i2c *i2c, =20 spin_unlock_irqrestore(&i2c->lock, flags); =20 - timeout =3D wait_for_completion_timeout(&i2c->trans_waitq, - msecs_to_jiffies(wait_time)); + time_left =3D wait_for_completion_timeout(&i2c->trans_waitq, + msecs_to_jiffies(wait_time)); =20 - if (!timeout) { + if (!time_left) { dev_err(&i2c->adap.dev, "irq read timeout\n"); dev_dbg(&i2c->adap.dev, "send cmd count:%d %d\n", i2c->cmd, i2c->cmd_buf[i2c->cmd]); @@ -627,7 +627,7 @@ static inline int jz4780_i2c_xfer_write(struct jz4780_i= 2c *i2c, { int ret =3D 0; int wait_time =3D JZ4780_I2C_TIMEOUT * (len + 5); - long timeout; + unsigned long time_left; unsigned short tmp; unsigned long flags; =20 @@ -655,14 +655,14 @@ static inline int jz4780_i2c_xfer_write(struct jz4780= _i2c *i2c, =20 spin_unlock_irqrestore(&i2c->lock, flags); =20 - timeout =3D wait_for_completion_timeout(&i2c->trans_waitq, - msecs_to_jiffies(wait_time)); - if (timeout && !i2c->stop_hold) { + time_left =3D wait_for_completion_timeout(&i2c->trans_waitq, + msecs_to_jiffies(wait_time)); + if (time_left && !i2c->stop_hold) { unsigned short i2c_sta; int write_in_process; =20 - timeout =3D JZ4780_I2C_TIMEOUT * 100; - for (; timeout > 0; timeout--) { + time_left =3D JZ4780_I2C_TIMEOUT * 100; + for (; time_left > 0; time_left--) { i2c_sta =3D jz4780_i2c_readw(i2c, JZ4780_I2C_STA); =20 write_in_process =3D (i2c_sta & JZ4780_I2C_STA_MSTACT) || @@ -673,7 +673,7 @@ static inline int jz4780_i2c_xfer_write(struct jz4780_i= 2c *i2c, } } =20 - if (!timeout) { + if (!time_left) { dev_err(&i2c->adap.dev, "write wait timeout\n"); ret =3D -EIO; } --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAE9E15B111 for ; Sat, 27 Apr 2024 20:36:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250197; cv=none; b=RR0srVBP8+G6bNo2iQIC0M77Wyp8Nl7600J9jAFPBNadUdnGhvgmBqQR/ryDXnM9PKnNP/5wdNF6eIZoztQRC9gXV1Cq8vsjouM4iFBtnqTMq8jVN1zBvrzoyGCvVSvZCmU6JMFtnMQ+d1jE3dIgtWvB+kbTsosaQEtEBuOgwZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250197; c=relaxed/simple; bh=9xH6xQ0iM5hWBrxXUfKOBqLqw+/88LiBx0LmN8wQM+4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QVaJWTpomae7qsfxUfpBbG9eg6EhBF0WREyqN6netOSc6gtomII1a0az5NAUctyU5cRfBkr/Kz8+76qXHu1xkKZXJYbPWKqWQjmosXew26j+o1v3bTyJ2m9YQWzx597qs5SwOb9AjxH21oeJpkf2pawx6vZ/h0d6Cj8k8YtYoFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=SQfDD+nq; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="SQfDD+nq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=cTlq5+NeurWDjBC43r6sTnS6ae5jK95Gz2jK8PwGMpI=; b=SQfDD+ nqamKv0HLFYg+o9mTGxdZI99eK8DpiOQXl2bwmqlDEzxaLvDil0CuTKV/f+4K2Hr O+FfuoVmtMXuvI5cB3472PyEZmWA6rKaEN66Sr64/Cx/OKbKxTPRDqS4nPPdZVZi M1e/O2g+pHDavELKX/Ms800bRXRGkHfgZKIQMhuzox7TmE2MG8eyR3ezOTd6kLDy H4r4z+ZotMno2uiIi+cP3T0RlzY7kGWjnFkooO7+mCcx6j3ofkvGPq9ra6vTIOD+ IVCWx4AKXPZAuUzOf7zlvXp4TfC7r9MjEDtM/SpkCyknsxc+/p4W/76VzenzjwFE 0Nio/4WWwheNDxnA== Received: (qmail 1782081 invoked from network); 27 Apr 2024 22:36:24 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:24 +0200 X-UD-Smtp-Session: l3s3148p1@beZD+RkX8M9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Bjorn Andersson , Konrad Dybcio , Andi Shyti , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/15] i2c: qcom-geni: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:36:04 +0200 Message-ID: <20240427203611.3750-13-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_for_completion_timeout() causing patterns like: timeout =3D wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang Reviewed-by: Bjorn Andersson Reviewed-by: Bryan O'Donoghue --- drivers/i2c/busses/i2c-qcom-geni.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qc= om-geni.c index 090b4846ed62..0a8b95ce35f7 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -586,7 +586,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c,= struct i2c_msg msgs[], i { struct dma_slave_config config =3D {}; struct gpi_i2c_config peripheral =3D {}; - int i, ret =3D 0, timeout; + int i, ret =3D 0; + unsigned long time_left; dma_addr_t tx_addr, rx_addr; void *tx_buf =3D NULL, *rx_buf =3D NULL; const struct geni_i2c_clk_fld *itr =3D gi2c->clk_fld; @@ -629,8 +630,8 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c,= struct i2c_msg msgs[], i =20 dma_async_issue_pending(gi2c->tx_c); =20 - timeout =3D wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); - if (!timeout) + time_left =3D wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); + if (!time_left) gi2c->err =3D -ETIMEDOUT; =20 if (gi2c->err) { --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9176D15B56B for ; Sat, 27 Apr 2024 20:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250199; cv=none; b=AVNnIOPfb/eRKuHJmyAJYInRn6uPfIUHzkc06TqmrZZRhPxh33Nu3CNbibdxZ8bG/Wr+HR2WB6SbFY52lR7JNRfVHXVD0GtWpm7AGPWUIc+Vp2HrDHzQ54A+cNkOPkd7rQaub50VIdBujRa9DOmgbIazqZNrtnLs9K5yTG2ay3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250199; c=relaxed/simple; bh=ICJxO/oSoreCPN4scyq2cUFCghZPxBGHSD5xgC0rDFY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LIFaPvt+xQHq+tNdpy+IIS6STAv4zSoycWluVeXe0w8z1Zq45C+fXEnX9F/+tZNDyo4N/oDVdMd6WDnQ2vqNNRNeukM6WgMlHiop4wzjMIu1XPXpms9/V329wTDSfRVXcHBZ3K9kX5Bg2t/Oy8/L8PzNzTWn+QMJxWmrwgyZ6vU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=aM1UUK0o; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="aM1UUK0o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=Mqxa2PoRjYYBR4TQvcaMfBjEHimjCGFPRonW4OLsXg0=; b=aM1UUK 0ob0Dn1guHJxPMrE1lLm/SPHStcdwkVQLew562thX6mna5R/Eq7H38PKiLYDFjNw AvZE/2YHutuyWnenR8vGOrC1lzVizEfWj7mFHEaRAjc9IOzg34sGj4BPYpdfpLK2 jGCxEtGRnxcsEo3ayNe+2qOF9jMK6AMstMX5gjJnBHJinWS5TvxbjYH1HNWlMPtX aAAIHK3wO8PKKZwtk+DC1RyXw/wAp8gldZqHVVckF/Gc2+eCZyfwfPaTvDb4PrWU fFlLppn+xVHWqddAFCNyZapTgGXCt9JnbZ+g9rxlERvRuyISt5cb4Ae8KNjmXHL3 //dirk2CdNRzy6tg== Received: (qmail 1782108 invoked from network); 27 Apr 2024 22:36:25 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:25 +0200 X-UD-Smtp-Session: l3s3148p1@WgJR+RkX/s9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Heiko Stuebner , Andi Shyti , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/15] i2c: rk3x: use 'time_left' variable with wait_event_timeout() Date: Sat, 27 Apr 2024 22:36:05 +0200 Message-ID: <20240427203611.3750-14-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_event_timeout() causing patterns like: timeout =3D wait_event_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Fix to the proper variable type 'long' while here. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-rk3x.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 8c7367f289d3..beca61700c89 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -1060,7 +1060,8 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *a= dap, struct i2c_msg *msgs, int num, bool polling) { struct rk3x_i2c *i2c =3D (struct rk3x_i2c *)adap->algo_data; - unsigned long timeout, flags; + unsigned long flags; + long time_left; u32 val; int ret =3D 0; int i; @@ -1092,20 +1093,20 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter = *adap, if (!polling) { rk3x_i2c_start(i2c); =20 - timeout =3D wait_event_timeout(i2c->wait, !i2c->busy, - msecs_to_jiffies(WAIT_TIMEOUT)); + time_left =3D wait_event_timeout(i2c->wait, !i2c->busy, + msecs_to_jiffies(WAIT_TIMEOUT)); } else { disable_irq(i2c->irq); rk3x_i2c_start(i2c); =20 - timeout =3D rk3x_i2c_wait_xfer_poll(i2c); + time_left =3D rk3x_i2c_wait_xfer_poll(i2c); =20 enable_irq(i2c->irq); } =20 spin_lock_irqsave(&i2c->lock, flags); =20 - if (timeout =3D=3D 0) { + if (time_left =3D=3D 0) { /* Force a STOP condition without interrupt */ i2c_writel(i2c, 0, REG_IEN); val =3D i2c_readl(i2c, REG_CON) & REG_CON_TUNING_MASK; --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5184C15B13A for ; Sat, 27 Apr 2024 20:36:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250198; cv=none; b=YIZ6zXQq5c53SX48VeSBUB0UY1Pn2EDexERZ5AM67YsOsvWqnVZDjJ8e1DaaY4hENG9FDZSQ8Tvhcm/AUOK03RzLrJxSKzuKtdlf/r22XC3df/5DkY4vP2gtSwM8/fD1u1XNFlsejhBkK51PInpQKkHXMepOxs/qJwuYrBiDPTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250198; c=relaxed/simple; bh=Vr6FJGRmH65/Z+SbGDHhY+dUnDZnbqoip1Sy/Q8SJio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sc0JFICvmNIltaLHoaVV3ZSEgKW5FAOr3hvIgzyzbovHBXAgZsQ0MwUV1C/tCvsoZgOjtxbCAz8VqGnQj9bUyl0SzmAF9FzB9S9FJoyhRojU+TqPxWxRByuy8mchtuMMjMapWx0ukbMOVzZJM0p5N686lukaHw0YLRFFVDZBS18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=bZBZ1isp; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="bZBZ1isp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=wxBftEHkYMQUmyq9eqJI/NqAPsdhyx/MQOFdHVmTJFI=; b=bZBZ1i spPigwswTyePXwpc39oBGmZ4zvAHVdFIS4CJQshYU094QHut33dW4aqiCNUO8Wt6 OcrK/ADcvb51QkO65EuSr65gz45DiXUfyqLXfGFIMVcUk6/CcaoJvRKU45hMmT0w 0SSRhKfof4aR6E36w/SdP3kUbcHgGWfQfmUvSN5BT5uwLU0ZkGRFRj4euNRhhhhw oWFzu0sSTof4uICSb0Gs23/c5yGCwkioIIMeRwpcQfw22SW6jo2A+g/hiCCoBis1 3JVIMP8sKT2JGKUfXpYAysXmXa2bqJC6dQI1awnDvTGQAVQvLaIYxTWjyAUOuUaF xDNkIVIhtJhAlprw== Received: (qmail 1782144 invoked from network); 27 Apr 2024 22:36:25 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:25 +0200 X-UD-Smtp-Session: l3s3148p1@7Phd+RkXBtBehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Krzysztof Kozlowski , Alim Akhtar , Andi Shyti , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/15] i2c: s3c2410: use 'time_left' variable with wait_event_timeout() Date: Sat, 27 Apr 2024 22:36:06 +0200 Message-ID: <20240427203611.3750-15-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_event_timeout() causing patterns like: timeout =3D wait_event_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Fix to the proper variable type 'long' while here. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-s3c2410.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2= 410.c index 275f7c42165c..01419c738cfc 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -685,7 +685,7 @@ static void s3c24xx_i2c_wait_idle(struct s3c24xx_i2c *i= 2c) static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int num) { - unsigned long timeout =3D 0; + long time_left =3D 0; int ret; =20 ret =3D s3c24xx_i2c_set_master(i2c); @@ -715,7 +715,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, dev_err(i2c->dev, "deal with arbitration loss\n"); } } else { - timeout =3D wait_event_timeout(i2c->wait, i2c->msg_num =3D=3D 0, HZ * 5); + time_left =3D wait_event_timeout(i2c->wait, i2c->msg_num =3D=3D 0, HZ * = 5); } =20 ret =3D i2c->msg_idx; @@ -724,7 +724,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, * Having these next two as dev_err() makes life very * noisy when doing an i2cdetect */ - if (timeout =3D=3D 0) + if (time_left =3D=3D 0) dev_dbg(i2c->dev, "timeout\n"); else if (ret !=3D num) dev_dbg(i2c->dev, "incomplete xfer (%d)\n", ret); --=20 2.43.0 From nobody Mon Feb 9 06:21:14 2026 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AD3B15B969 for ; Sat, 27 Apr 2024 20:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250199; cv=none; b=J2onMfGkSeVlxOYIU7EK0nFPKIHUcKs4dIHUe8QAHZu/ElNFwcnwHA1cOj6SEc7OIFZf3xJC3CG7QKqaMRkzIU6EoyM1w83+LDhImXAscak2Qa0PsI0Wsflb/LoUcbumtXb1qWcQEOiL1GairMdvNNqIhipA97K/LqV4sD5BZqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250199; c=relaxed/simple; bh=BA9bKWx4nrZdq7zvoPVntWdYdyVT2NvRtG21GKlQIxY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H3X3oqZV4GN2RNjFF+sTTgaqGtdvhdppKKX0X/ULLBMjs1W+QGSnb/fquCxbrmlD62HWv9OYDEfK/qUmgTk+nXhZXAvoEVthlozyLxzUowHlFvbPtjtn2knbE+cMLqX6JH+QndNcYcuyDHNPmTP8kEIdsAlljD1iQf9XfmW23bQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=bmUe8aId; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="bmUe8aId" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=3uCHmpzl3WtCK5SCHOPVCTNXQWYJSoA3BmOOvRjEviM=; b=bmUe8a IdlDGSajE+mYdkF4MF3n0m3YjFrl89uuW+ZZ2QAH2Ipm70JwAiFZ1utJGIxfRWxa j4SeE0874pDNNNmB0KewZw+KAHKtCTlGH6jugUI/WfvDoGVapoBKYM6KN37sTqVR SqieJYdAnN6ul13QhFYRSDMokj4/rofPpfBrWfuFJzcbXNXVQUcLXj1z6FfRCSaV AzySbw8iXVMNxbUA6i6r8JdaUTj/SlGpQeyrYh22Q6xrm5lT/M6jobhY3Ti2boEE k2GaiJJJGixcRTd1l+2VazGNR5qBdWRRARa+oNx2AQJslIPTagM1e0Zv79JTjcH9 3Z8fl8WbN19pzxOg== Received: (qmail 1782179 invoked from network); 27 Apr 2024 22:36:26 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:26 +0200 X-UD-Smtp-Session: l3s3148p1@A2Rq+RkXCtBehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , linux-kernel@vger.kernel.org Subject: [PATCH 15/15] i2c: pxa: use 'time_left' variable with wait_event_timeout() Date: Sat, 27 Apr 2024 22:36:07 +0200 Message-ID: <20240427203611.3750-16-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is a confusing pattern in the kernel to use a variable named 'timeout= ' to store the result of wait_event_timeout() causing patterns like: timeout =3D wait_event_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the c= ode self explaining. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-pxa.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 888ca636f3f3..f495560bd99c 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -826,7 +826,7 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c = *i2c) static int i2c_pxa_send_mastercode(struct pxa_i2c *i2c) { u32 icr; - long timeout; + long time_left; =20 spin_lock_irq(&i2c->lock); i2c->highmode_enter =3D true; @@ -837,12 +837,12 @@ static int i2c_pxa_send_mastercode(struct pxa_i2c *i2= c) writel(icr, _ICR(i2c)); =20 spin_unlock_irq(&i2c->lock); - timeout =3D wait_event_timeout(i2c->wait, - i2c->highmode_enter =3D=3D false, HZ * 1); + time_left =3D wait_event_timeout(i2c->wait, + i2c->highmode_enter =3D=3D false, HZ * 1); =20 i2c->highmode_enter =3D false; =20 - return (timeout =3D=3D 0) ? I2C_RETRY : 0; + return (time_left =3D=3D 0) ? I2C_RETRY : 0; } =20 /* @@ -1050,7 +1050,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void= *dev_id) */ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int n= um) { - long timeout; + long time_left; int ret; =20 /* @@ -1095,7 +1095,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struc= t i2c_msg *msg, int num) /* * The rest of the processing occurs in the interrupt handler. */ - timeout =3D wait_event_timeout(i2c->wait, i2c->msg_num =3D=3D 0, HZ * 5); + time_left =3D wait_event_timeout(i2c->wait, i2c->msg_num =3D=3D 0, HZ * 5= ); i2c_pxa_stop_message(i2c); =20 /* @@ -1103,7 +1103,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struc= t i2c_msg *msg, int num) */ ret =3D i2c->msg_idx; =20 - if (!timeout && i2c->msg_num) { + if (!time_left && i2c->msg_num) { i2c_pxa_scream_blue_murder(i2c, "timeout with active message"); i2c_recover_bus(&i2c->adap); ret =3D I2C_RETRY; --=20 2.43.0