Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1295545lqa; Mon, 29 Apr 2024 04:42:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSl6jthkaz8eyVzPbc5outmg9CDh1BQ1lkJAYu4RGVmRCSgvxlTUJwcIrWzO3lIRyaGcAwCz8xl2YSOEmdBhAZXBJ7h5bS0NkjchVB3A== X-Google-Smtp-Source: AGHT+IEtQ3F0FV+W4Nqat6wRumMGO9SEosWY7er5HV1zYP8Yo9OjNitCUnUi5zobqz7vWatYZ18y X-Received: by 2002:a17:906:3b48:b0:a58:ea69:3f5c with SMTP id h8-20020a1709063b4800b00a58ea693f5cmr3963537ejf.75.1714390940523; Mon, 29 Apr 2024 04:42:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714390940; cv=pass; d=google.com; s=arc-20160816; b=kVvqeUh+peJXa/Nk9D1O45x3JRbWLpnbWO4Sniqpn5dGGhztMiClYzpZ+Vo79f3ztv ybsY9Iy+Kpyvrr1jO4r1f0/wF+1ZqEr4bFBfjcTcO00L56uw2C1W6lcCZifGbdijn7yY EYTUTUwcRHjL4HFeb+xV17TMs67z+HHkTLErv4Y6TkT88jOLzgM1xWOs755XNh3JIukg TXPGLtsyVsySMGKunrfLiVz6f5UFn5BOTjKbxhXq7aVXx1Y1CAYPNZkUakWL5CDbvXXc eB62SzrvcQBUYea32tBMIQ1kJ9OwEBFmd5S7Z1pTexWHLocPifSTUBwp2uFwIRcboXAL 2Vpg== 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=ytaMDbrRHYTkVlHscVH3Jk5trLpcIFOkGRyH/ZBVpu4=; fh=/xHfK+FHhb56Cp0vhBwNkd44bQImmfUDQZL9BYxEkZw=; b=SH3oLS7DIaENT0DmFx4bHCkC6ju1aKig9Vd4UU8QamdJ/OEkTptMMqaTLOI8FQasgo aXyil3I3zOy6FpTKiPpdvyvuLhE2uUrh1giq0H8zCuqvAfidTIMcj2k3w0THy7OQ4wyx X86vzP3g8MrGaAT9mi4cuuURTcTCge6/qrYcut/bfpvcvHD1Oj7LAMajoBsv4IoU0y5d abgb1dUab9SbnHHkiuZaZaa2lsr0ZYQDfgDQHYPY8tR5jqFdOiCj2z0Rx3sVYwZDC5AF EZVstT2OkmNeHc96E4gm4kVBXNQ4BKAm6dN08RIJ4Pgf7JXoIFljQsuA/SuRan1Sfnb5 XlmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=b3o54+FB; 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-162152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162152-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id nb33-20020a1709071ca100b00a58bc212b3bsi5224726ejc.412.2024.04.29.04.42.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=b3o54+FB; 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-162152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162152-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 80F941F24205 for ; Mon, 29 Apr 2024 11:33:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BFFE482C7; Mon, 29 Apr 2024 11:33:19 +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="b3o54+FB" 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 CC2A74501D for ; Mon, 29 Apr 2024 11:33: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=1714390398; cv=none; b=pKfCqYBwTH8Ih7/0+4gVWvKiPxZeGaHrPzH+eg0dUlp+HLv3T0/t27z5qdOL//f/v6DzyxGSdERHie9gwpAPh4Mugpj/s5EEMg6uh5DWyxw2EpLscj5sF6rr1Cm5Zj9IIwk3werldA0LGZp3E+BJKgXdq9mywKx74aujKmtB1VI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390398; c=relaxed/simple; bh=V06hBJ0AbH+QLN6vjA3YFpErKpkzt+h3vT6AjALWIu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TXpjxzZJ1020cpKejup6PCJobgZlGhN22U3GhglcPffjI1VV51TcQcA1TSTmjnC0XwvVa5AhHLlPFcdZ7xvZRHai95v+SaQPsTHtktOHYjh0zxQJK+dLxIuiKdCyH3kxTTvXHV6coRxN55E0DDrn5VlCnEi7AFx3NrfTtfBlNXc= 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=b3o54+FB; 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=ytaMDbrRHYTkVlHscVH3Jk5trLpcIFOkGRyH/ZBVpu4=; b=b3o54+ FBrZMOOENh3SFIj9rXzdWDB/PlMnG8ozVY6pIS70/2X2gDbHZh7H5/OaLvIdk10Q SGkowgG2M3LM/2Fv76mbrNXLogK9XXlIG8m0du4N6MiddcbLQ2tql2FMRoi2rdFH +67ppN7OH0BrBmUlPfOzeRhXcly+NgABG9vRkN6ZFYg92iQbIRdvZ/twGC3odSbi sXm9EIA2wLjnDAqy8d9mavlUOZiYeFXUXGAZB57swnNffTEUcTuwb2+FRDaqhrYu uwWxLEiTnz/30pRG0WfuVVaKhEjM1Qgubcwd+OB4iC1pSV26uJZAFpkg3hzwSF9m Lsl9AZOTeskRDuLg== Received: (qmail 2280987 invoked from network); 29 Apr 2024 13:33:15 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:15 +0200 X-UD-Smtp-Session: l3s3148p1@rkh5njoX3kFtKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , linux-kernel@vger.kernel.org Subject: [PATCH 1/8] iio: adc: ad_sigma_delta: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 29 Apr 2024 13:33:04 +0200 Message-ID: <20240429113313.68359-2-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_timeout() causing patterns like: timeout = wait_for_completion_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/adc/ad_sigma_delta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index a602429cdde4..40ba6506bfc1 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c @@ -206,7 +206,7 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, unsigned int mode, unsigned int channel) { int ret; - unsigned long timeout; + unsigned long time_left; ret = ad_sigma_delta_set_channel(sigma_delta, channel); if (ret) @@ -223,8 +223,8 @@ int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, sigma_delta->irq_dis = false; enable_irq(sigma_delta->spi->irq); - timeout = wait_for_completion_timeout(&sigma_delta->completion, 2 * HZ); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&sigma_delta->completion, 2 * HZ); + if (time_left == 0) { sigma_delta->irq_dis = true; disable_irq_nosync(sigma_delta->spi->irq); ret = -EIO; -- 2.43.0