Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1292328lqa; Mon, 29 Apr 2024 04:35:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNmA/nFlOLSF3QX/VHYqcYe186Cgr+UqcsNO37jNhG87g01VpV4v/iCPCh5AGoCWVDaZ4Vx0lM2RqSCGPAO1GNspC5eMW0sL7AZ51wuw== X-Google-Smtp-Source: AGHT+IFODoQe0A2RK8MfQR7sB+tOV4eGnX85/HaeYOyO9cXWb2Va7ixs/dlSPLwfe6tzQvndCYpt X-Received: by 2002:a05:622a:1104:b0:43a:e5d9:1c31 with SMTP id e4-20020a05622a110400b0043ae5d91c31mr3127526qty.68.1714390504937; Mon, 29 Apr 2024 04:35:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714390504; cv=pass; d=google.com; s=arc-20160816; b=J9DoD3adzBrf60Bsq+NdMZFc6JETIJucilGcSK3KPWKUnVdzfrtG6XOeTAHY6Iz1EW /zOZgOz8wLphmBJdK+BErjmgr8Kbb1X9l70b9WphEKdMreq7mqoKfYJYd7hv5/kiAwMi 4xR/iUYAf1yFJO0BcvYU5V41aenc7c1CoM5gFpFTbBPRaqpbNM9Pgo+Qf8dc8fhKId3d AIeN51Vbi+I9s+QAlirQfa9ZBgbr+MInhcvdxCSZcXkx7lfFGhupbS2sEYMI4IYnBAXa JedWZ6EsE/lBckDdIbWcwO4P2ABgpiJAhhLH1MY1PC8aKMU/2nyhJjv0uwMELZnBswIf IT6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9jrudQes/oY0ss0zHQRh6mDwrbJoU9KkQ26G3FR9LtI=; fh=4SoHmQ0v+WcOiK+WZWiDaQ1nv5brMaoUZ1bE7XYUE44=; b=n4C2vTqw1TJ3ReiFy5aGcaIqXGAAuwiapaIJmOXLWBeG9oY32be4XnZHX84H2RBigy +Yp1H2q9KjyXSs+tuWzgcMB3WKQvxCCTK5F4tSabKiJI+mhDUuP4ncLNAY99B2dXZj+E nEE40tdqiFkmuLkaFoL7jrVQKchB4jKruGDRWQ+F87aDGOz1rbfIB07qO90Cqoz4sgd6 ysGMIOfdXQLio5B8WEfe8J2/UkyAA7UgFRLTtkquSuq3nJ8UY0NKP/9m4QPiWzgt2dhg WtaBRIrYBKgatFTeJiT5nJvxcKD8qJNBL/7VPlq9urcMNn0q9jqa3sqK1/72nF0gN/y6 rVFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=ihc0ZqSZ; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-162159-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162159-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g22-20020ac85d56000000b0043acc1313ffsi3357972qtx.168.2024.04.29.04.35.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:35:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162159-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=ihc0ZqSZ; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-162159-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162159-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A7C401C21077 for ; Mon, 29 Apr 2024 11:35:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A53854744; Mon, 29 Apr 2024 11:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="ihc0ZqSZ" 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 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: 8bit 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 patterns like: timeout = wait_for_completion_interruptible_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code 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 struct iio_dev *indio_dev, struct zpa2326_private *private) { unsigned int val; - long timeout; + long time_left; zpa2326_dbg(indio_dev, "waiting for one shot completion interrupt"); - timeout = wait_for_completion_interruptible_timeout( + time_left = 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 struct iio_dev *indio_dev, /* Clear all interrupts just to be sure. */ regmap_read(private->regmap, ZPA2326_INT_SOURCE_REG, &val); - if (!timeout) { + if (!time_left) { /* Timed out. */ zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", - timeout); + time_left); return -ETIME; } -- 2.43.0