Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1292316lqa; Mon, 29 Apr 2024 04:35:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXzOFPQsnGed+NQZSP7z9RdweBDXsTPZVOsk9BTzT8MJmoOPmZqLHKO6PNjO8qqzQieEQDWYfdB6PZa5OsgGT8CbwiY1W60GSOqjlHU8w== X-Google-Smtp-Source: AGHT+IE62fACJrxWp8KiaCEmbIv8hQ7TMYyWUX3adQfNjz9De0VzbISLavZ1AIjvI724nvId+75z X-Received: by 2002:a17:902:d4ca:b0:1ea:657f:318f with SMTP id o10-20020a170902d4ca00b001ea657f318fmr10376746plg.0.1714390503226; Mon, 29 Apr 2024 04:35:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714390503; cv=pass; d=google.com; s=arc-20160816; b=pcBKJRnSxdmC78HwCal1Dz+g8tMd7ui6WHVUTXKXVw2tomstnuHhp2MO6ypvseiN/F XMWH7py8Pi6wXOf86NBL3mQMuGrOXNLnbF+x13XkO9MsZt9WjyOhvHQcye8AIUNu93oI I4VidjFOhx7ZMvbE5Q49t6KW25UG+3nQEaEMOL6XmrsULZDN3L6bPrZjnFAKeHOCfXk4 1OVkfx/Z/la/Kt9vNL43kI5b1NbJTfLGkayjrawsidrv0w6SIWzsA3Yh7KUhKu/WcwYE kBQ0rrIK6TFXbHbdChwbKMkgPgHcsEQnNZmb+AEllibWi4m0ng0kCg/fCHmrlIkZ166o mq5w== 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=7WxOY8Hqqwt7I9BFZQWHS3JVVzhT3Xl4XwRHu/Qd27g=; fh=4SoHmQ0v+WcOiK+WZWiDaQ1nv5brMaoUZ1bE7XYUE44=; b=FEblyonr7Kk02IAmIZgU0FHqRz+x5JAoevCadu7U0PDuUvZ3yqPK587GlrmULKxV4Q EjOG3sIR/heyEMcvqivM0iBNOfyyCXex5UV1HWZXqTRNY8KEt1YxtvU6ByPot3HNe/Os CuEudQq2DprVTuiIO9Z2NkR/t+g+VGXwMesguQc4J2Z0JByOpERUCE03tJu8y1dRPleu wBqHP/r6p41QAXbELlku3jqHOkBGmrPfNLAZyCzkHZfegOJ3WzbPEU/Dgq+mV60RH8rv nXBiBY8D+Gg1r3nUHIRAiGnaE4llph+fxMNsb7KHc8mfWvKMOpdlb2TedqSpKvYc8n28 5O7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=MAcOPI0n; 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-162158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162158-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o14-20020a170902d4ce00b001eb49eeba1fsi4305602plg.488.2024.04.29.04.35.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:35:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=MAcOPI0n; 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-162158-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162158-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 439B72828BA for ; Mon, 29 Apr 2024 11:34:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B897E5380B; Mon, 29 Apr 2024 11:33:26 +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="MAcOPI0n" 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 4AF8152F6A for ; Mon, 29 Apr 2024 11:33:23 +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=OVXfzCu94opsjDf5j7f4FaS+TPA4rLkia1ZYdwwUlCxKPCQeBKk0+osxhO5i/5oyfkob0TiRokgi6mbOooJOJsYsBgsOJcbySBIbAci7S6F/WsUGlWsyTQFGS/XmR8wmXt/On1PnE9MJrxisY4KNQRfzWePYQol8Le2Tng60fpY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390406; c=relaxed/simple; bh=IdhLliF3I34ob0fmKFJFFe1MNaGnbf324kblqz/L3Xc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OxdJuiXVEGTdobJT8g2sSfa7iX5N6GxccrxP/Lm1czAer6ZSuAvwAv0t0MfgTbWBNFzHYKQ8UJB4hfJ3uiknwXkXCst1fWfmjofUggop3X2mWSe8dSbyO/y/X3wuSMZbD06L0lBIQETYmadU2DBjGybnCoQ09VGXVEWDaGxbr7Y= 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=MAcOPI0n; 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=7WxOY8Hqqwt7I9BFZQWHS3JVVzhT3Xl4XwRHu/Qd27g=; b=MAcOPI 0nVZbpF/9LmEWS+jfhT6KB5iGcddFfw3W2h1I/GkPINuWNAOe91u9LkMvbRVfKu0 htmVWfgJ936SU9etiRTSq5DEkdzudVwN/DipUwQjudjxwYvfNECJp3/RNrrzmLGv 4frOCNdzrmTeuFDRFNrsu3YTYcS6qXzW0+MF63SJvuHkJeOkTtJVD7ewChf7b6AN ThRKejPl1aM+sgRM/aCc/I0qi/9a/ODYWLRdIewBkQmafOcO9knhbhlpd6WD8kvc LXi2oawrYGEatSc2ODKDmHw1t2LRShRVipIwoL7dHsOvbzyL8nQN0CLuwI8kQE7I G+pqdtVCfWGFSEJQ== Received: (qmail 2281230 invoked from network); 29 Apr 2024 13:33:21 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:21 +0200 X-UD-Smtp-Session: l3s3148p1@L1fWnjoXpy5tKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , linux-kernel@vger.kernel.org Subject: [PATCH 7/8] iio: adc: twl6030-gpadc: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 29 Apr 2024 13:33:10 +0200 Message-ID: <20240429113313.68359-8-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/adc/twl6030-gpadc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index 78bf55438b2c..6a3db2bce460 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c @@ -519,7 +519,7 @@ static int twl6030_gpadc_read_raw(struct iio_dev *indio_dev, { struct twl6030_gpadc_data *gpadc = iio_priv(indio_dev); int ret; - long timeout; + long time_left; mutex_lock(&gpadc->lock); @@ -529,12 +529,12 @@ static int twl6030_gpadc_read_raw(struct iio_dev *indio_dev, goto err; } /* wait for conversion to complete */ - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &gpadc->irq_complete, msecs_to_jiffies(5000)); - if (timeout == 0) { + if (time_left == 0) { ret = -ETIMEDOUT; goto err; - } else if (timeout < 0) { + } else if (time_left < 0) { ret = -EINTR; goto err; } -- 2.43.0