From nobody Fri Dec 19 17:00:21 2025 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 2211C4C610 for ; Mon, 29 Apr 2024 11:33:24 +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=1714390406; cv=none; b=WRob/1eR14yuWjjpFyDs/uHF66HvNLHgbyRfizxSQmOcWQ9Dxkkn8Rbt/FZnGE4/NYXhzPysjbs/ZdkldWf7e21snw5wrFVMSKCmw9jrCiOgmYnr3TaHO0dvCp6Et2PmdkDqB/AI8iAgnGURQykXsiWOX2g/vHHuuj7DbrTR10g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390406; c=relaxed/simple; bh=2uX3wkKhmFCqFWQCxlFoe6vDeE4dnIiY2m9s/rKq9oQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=htcXIvGhfXKsIWwdbVLMRktg1BufMQoglihBAcov+r4aNUacMxXhCeLuXklaAhRohY72sm9WapXiZKvk0DZO3kOozWGu2GLFBbgxZs5ro5GezK9VNcHINzxpMC3xoa52pEUEDr+2jPrhyguKP4Y+B/tIn4xWvZgSxUx5tyWT3Qk= 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=ihc0ZqSZ; 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="ihc0ZqSZ" 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=9jrudQes/oY0ss0zHQRh6mDwrbJoU9KkQ26G3FR9LtI=; b=ihc0Zq SZ+nOKe3RRSC5eQoHXP8j8Hk/Po3Xqz96sq8eRhN1khue2jt5X4jQN58u6jU8SFJ 2JVq/t8DKkv9Srcoj5KncOteHfb8dj4CS9ZOlqRupOPuMya5hb6u+3+uyt07Lpui TJ5sboFZvNBWE739ZvfnbptMghuQkUAj6LqAo7stf/vp+qEbd1aDCGE8aPw2BaWd 2OVKIH/oXEg72lsXa9npyf6wNzpKwghDhdAhEPGSEC1UvvSQiufL9+fP2caxGCVj j2FoS0LLbD0nPO8Ei5nze1Ic7PPsdS6bvjh35p3Ooc7ssLLK9y1cwjUkpYZUQ5sv CXoCgO/OVKFQEF8Q== Received: (qmail 2281276 invoked from network); 29 Apr 2024 13:33:22 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:22 +0200 X-UD-Smtp-Session: l3s3148p1@tgrlnjoXfEVtKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , linux-kernel@vger.kernel.org Subject: [PATCH 8/8] iio: pressure: zpa2326: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:11 +0200 Message-ID: <20240429113313.68359-9-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240429113313.68359-1-wsa+renesas@sang-engineering.com> References: <20240429113313.68359-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_interruptible_timeout() causing pat= terns like: timeout =3D wait_for_completion_interruptible_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/iio/pressure/zpa2326.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c index 421e059d1f19..dcc87a9015e8 100644 --- a/drivers/iio/pressure/zpa2326.c +++ b/drivers/iio/pressure/zpa2326.c @@ -861,13 +861,13 @@ static int zpa2326_wait_oneshot_completion(const stru= ct iio_dev *indio_dev, struct zpa2326_private *private) { unsigned int val; - long timeout; + long time_left; =20 zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt"); =20 - timeout =3D wait_for_completion_interruptible_timeout( + time_left =3D wait_for_completion_interruptible_timeout( &private->data_ready, ZPA2326_CONVERSION_JIFFIES); - if (timeout > 0) + if (time_left > 0) /* * Interrupt handler completed before timeout: return operation * status. @@ -877,10 +877,10 @@ static int zpa2326_wait_oneshot_completion(const stru= ct iio_dev *indio_dev, /* Clear all interrupts just to be sure. */ regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val); =20 - if (!timeout) { + if (!time_left) { /* Timed out. */ zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", - timeout); + time_left); return -ETIME; } =20 --=20 2.43.0