Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1296548lqa; Mon, 29 Apr 2024 04:44:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1pdu0VjMTgCHns7ZwJZcjnd50MOiE8GAvIPbUTAcQXZfr8oSIdTV4RdISHdLOWaK8ZGRooQt431DDW3PnzJDf5+99QjBHfC152UI5Zg== X-Google-Smtp-Source: AGHT+IGWzIOLw9IYI1mMkNz50w750NiMwivPkpbKLxmsoyvGt2SCiqRsYGjfId0xfAR85R90LBVW X-Received: by 2002:a05:6512:3e07:b0:51d:8b97:58d5 with SMTP id i7-20020a0565123e0700b0051d8b9758d5mr4020974lfv.49.1714391086386; Mon, 29 Apr 2024 04:44:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714391086; cv=pass; d=google.com; s=arc-20160816; b=vrO/PmEdVONQSm2Pk4I/sLkB9YqAoh5DZz9o5z8ptjZPdSepNxI+4YyqvUAjCQX3ov HIj5Rhn72nivBwxQhBW3hINQ7NHCiv3oFGPCU0GBXfKBuMuILrtaN/NTOoeuKdyMwqLA nuapIsOHysuJ/W/yLcmpV2xpi+9N/reqd5Ludcm7EtaZwbEo5GnMcjq5jXCr4wcbhCIe Z4fUMALrrSamFDdshMu2f0jAv4j7UpB0P3CD4PZcfcGRQnob9w3ls87Zl4I4hdRHYFP7 1NieBezFATDBenwxU1LNBddUpPuYOtJWd3A/jyf19mnI9Im34PkJpI8bYFNeO+YIkwlW S2tg== 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=jF+95jMp/45NMjGYJKM23B9xKBucPH4GAO56Jky3844=; fh=xTgOtOnytXNlJe9EpoAb2ektUErgGoW3iAtKQrSWCIA=; b=Nms/JirVREZx/niEHp2VJlzevj3UTkvwDAs5jcofq/r+mCNrCGYal1fFt0wr/xZ/Da iPr8VsAGBGpUPzrK8ZWvcmDApnYWJ1B+dZ8JeFWMqEb0HbV8CykLAJ+r/H/Dd4uAHXJl hPimQL5PJ0W43Vl8UeID056ok8SFNFDx3GGYBF6X5b4ROMJYfZ/3B1wAaf1Y8sahZzxd V8OCJyhaS3uUU/fw4EFIy4PKzPFaQjbUjXDdOxja0p/XcFOE3ZCKf9Rvu6sdunaze2eR 9Njr6I5bMYLH6A98E1pil5gIqhXDLVN5W8Kq9DbJFnXEl5Zqr9Yt4b1eWBDgOx7nHoZG IQdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=aRUD4h14; 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-162153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162153-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 m25-20020a056402051900b00572717cfee1si2409488edv.113.2024.04.29.04.44.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 04:44:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162153-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=aRUD4h14; 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-162153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162153-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 542361F243E9 for ; Mon, 29 Apr 2024 11:33:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57F314CB38; Mon, 29 Apr 2024 11:33:20 +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="aRUD4h14" 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 DBFDD4501B for ; Mon, 29 Apr 2024 11:33: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=1714390399; cv=none; b=F/Shi7TzTQckQ3MSa1kDsgcvId0lxQytn7zbT7g/dIuj3Rrz5ZPrLqyI0MapXDNjLA4M0voVbBJ4MBnE0JZXtrSdalyV91CFLWQxjwXPCfOM46GPUfbcCf1l+VmNfn1xUu3IewNaDptygmo5G2TrKP4QTBCXEvYxuLlJjd1t6xw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390399; c=relaxed/simple; bh=qjQ+LYbUEfrBtu3ymflLP9dmO9tQ6/Bs/eoY36v4nPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sYiDYFlPQsDQs7rBtY/QM1SG7GaqIk+frEB9ktfphea6Wt+jpkHISkmiSKMXndouY8Md3zJGH+mg8Cl6bG+cHZHVD8fEyHsJf/CZ8gI+F2BQxMW+xNUZ83MMxYQfKb8yaL8PgOFNV4wu+ZxU4dj/koXt+LZec6Z23Ei/muT+sfM= 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=aRUD4h14; 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=jF+95jMp/45NMjGYJKM23B9xKBucPH4GAO56Jky3844=; b=aRUD4h 14HkB1S+ge4YmGYHgC6e8z1QFZnIGEwb7VW6Wjs/dhS7SsCqi0J0cylMLueUjaEq AzQQSTtE2ukCCPvolzhDzwOet/OsyfJOcsP25SvVacjNnIPJWbyZdsFy8AWWXQjE JEN7NjXU5WZUMCKOJpmTB6Ol2U6ck+VZnD04dRml5NzTEEhWiHVaybCPCekVY0SX wmEad53AvSdMQtbMvJigWFQ9xmNYNoXjBHokUg6x7Y2SfWGm5GOz3V0j/rPqtQTq M79guIWLd/tJTTBZ5+/FF3GuhfhySodEF9CpOXSgD15S6MjKwX9XSsEl/ppis9Hs eSMz0D9XYsDRI+AQ== Received: (qmail 2281021 invoked from network); 29 Apr 2024 13:33:16 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 29 Apr 2024 13:33:16 +0200 X-UD-Smtp-Session: l3s3148p1@fvOInjoXqG5tKPB4 From: Wolfram Sang To: linux-iio@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Lars-Peter Clausen , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/8] iio: adc: exynos_adc: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 29 Apr 2024 13:33:05 +0200 Message-ID: <20240429113313.68359-3-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/exynos_adc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 614de9644800..78fada4b7b1c 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -538,7 +538,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev, long mask) { struct exynos_adc *info = iio_priv(indio_dev); - unsigned long timeout; + unsigned long time_left; int ret; if (mask == IIO_CHAN_INFO_SCALE) { @@ -562,9 +562,9 @@ static int exynos_read_raw(struct iio_dev *indio_dev, if (info->data->start_conv) info->data->start_conv(info, chan->address); - timeout = wait_for_completion_timeout(&info->completion, - EXYNOS_ADC_TIMEOUT); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&info->completion, + EXYNOS_ADC_TIMEOUT); + if (time_left == 0) { dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n"); if (info->data->init_hw) info->data->init_hw(info); @@ -583,7 +583,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev, static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y) { struct exynos_adc *info = iio_priv(indio_dev); - unsigned long timeout; + unsigned long time_left; int ret; mutex_lock(&info->lock); @@ -597,9 +597,9 @@ static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y) /* Select the ts channel to be used and Trigger conversion */ info->data->start_conv(info, ADC_S3C2410_MUX_TS); - timeout = wait_for_completion_timeout(&info->completion, - EXYNOS_ADC_TIMEOUT); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&info->completion, + EXYNOS_ADC_TIMEOUT); + if (time_left == 0) { dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n"); if (info->data->init_hw) info->data->init_hw(info); -- 2.43.0