Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1958545lqa; Tue, 30 Apr 2024 04:43:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpAMQqlPiXjBmXV5orAV4RqMFNaaTABAJCFXjFckHUvJmFaRHrzbqrw0sX/Zhm/ghS6xWNqyYWwmFSuEX42YxrXGvcZHgFCHxhjrc2Ag== X-Google-Smtp-Source: AGHT+IFZKRpVL6ayBdXrHikQvJYlayn7h8SexUkhnDxuzGIUfsBsw1hGmnnuVEICBiRd4VAVlS4a X-Received: by 2002:a05:6358:72a0:b0:186:102b:777 with SMTP id w32-20020a05635872a000b00186102b0777mr12024492rwf.10.1714477403078; Tue, 30 Apr 2024 04:43:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714477403; cv=pass; d=google.com; s=arc-20160816; b=M2FBmFd2E5KrlgYQimg8G0qyC2+9ggsKM1iMmGQxKZ7liu52cABEhVgGtH3hoJ38EM v5JyJcprq1n89JDSNhd1AoEkvZhYwQogdQWNbvyYdghTD0/yqghI/PhKtEyCci1ij0uh CIpd75LZqvfvtR49BjP4I1QgILpcSliew3ErWrcbcRDaSArYKup9WSNJ7SCaF3Ja64LL PG/9vpa82UIZR/odgAmllk8t8cODH3pjWa9SnuokrMo5YNjxExtTVKF2rh2uJ/hMNw9/ 1pDyqtE8U9m+psTxr0PqDjnmNOKF4ijnj3bVi7bfq60L6FntH6YU6cqWN5qMZ9etyJjg B71w== 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=wiD2un7//igTyi+4riuvfy4dW9R7R9MwCjnV7qyUbeI=; fh=HMmm4U7AbdvcJIoeDg7+Ktu1WvLDOfwmyLifKtq0VWM=; b=G75b0b1kUkeSRyQg0g+LvO16BvxH0WLhMq9Ooqvs4M1mh7fp3ZCJX7FNfqxzysk08a 2LhRQUnmZqKlbUK44KvsDgNzKQU8C+CBfP9p639PyPp/uxC8ZBPTgQ8igZlIKBQDIjER MOR8Tk7yXyNCXRKwkoQroAzAsK4+6XPUrUZMTaeifNhXNFx3nWndauaA/LJMQqclH1dq qlFKh0us+EiQpB2gM5A6mWrRxaYJZitQOsjsNn9fwwEkebnB1WKL64aPN5f1ntFhmQE6 sQ6aI0lrRmdznP0nPkwKicSW8FVCsjGGHCc6XiqeSHZkchNqq6p5fk3y2V8urFWgieGQ d1TA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=cpx3jULI; 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-163860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163860-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y20-20020a63fa14000000b005f75f3269d4si21854276pgh.96.2024.04.30.04.43.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 04:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=cpx3jULI; 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-163860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163860-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3C050B20DB3 for ; Tue, 30 Apr 2024 11:43:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15161144D2F; Tue, 30 Apr 2024 11:41:59 +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="cpx3jULI" 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 7F9C313F43D for ; Tue, 30 Apr 2024 11:41:56 +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=1714477318; cv=none; b=OZJ5hzFhvt47tZobjMg+fTkujM5UmVxJblhYcH/ZiKVrrSXxPuvckB2v4nC+n6omfodpGMLu0nvvuQQiqZFfzN7hgmwqys3ppfXv8xUcvczjbc//l/LLOxfII269uh4Vt4ST09qwRKziuTTRKg5YMtBhz9+QtHztRPj//P7szCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714477318; c=relaxed/simple; bh=ZZCt1Knc3LTkd7ud87jJX+jMQvb71Ot0fnQdxWqqxKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KiSSidYLXbvI9/ipJvEB+urVO8zynfk/oB6IRZ8FMnw5WAFeXde742VkkzDLHmCK3OS9nl/HmcvhK9ngy/BDqdMtjqNSZHNo8T6EBnKzPOCXW68jBV1snEdUV/Iug3GmYHwADQIX/Q7zOhxw3eqtEUQgRrijBohgTVGHI9PP4L8= 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=cpx3jULI; 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=wiD2un7//igTyi+4riuvfy4dW9R7R9MwCjnV7qyUbeI=; b=cpx3jU LIpMOrPzwVUfdli8JjTbZdSHbvmznoBXTbbslqQ9tvVwjD00xZs67M8KhRUQK219 hFsSTsuI8MAUU1GgdKv79Z+vieH7fmggAqv+iPNN+3CDOdLUm8mzVS7z+gOpZkch AXJKQ+/Xz0PcNHwCvNqL/jsH45NToBmuOWcTwl4zfB7NAeC5bZIX3W1C2b1PnmJR u19Z7rR6zwBS1YNK+vyL+9TnBjd/Dufj7SB00KicTs0K2pFE+Ma500u4HThxAwpv SW/4TheSsA0KDU5bqDZhHls0aZp+5x3PYnHB1BombSGTqVsVesD86I8KbjYQcFcE fnkFSiXpWcpJPaIA== Received: (qmail 2617893 invoked from network); 30 Apr 2024 13:41:48 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:41:48 +0200 X-UD-Smtp-Session: l3s3148p1@16rm2k4X1uhehhrb From: Wolfram Sang To: linux-spi@vger.kernel.org Cc: Wolfram Sang , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH v2 5/8] spi: pic32: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:41:37 +0200 Message-ID: <20240430114142.28551-6-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240430114142.28551-1-wsa+renesas@sang-engineering.com> References: <20240430114142.28551-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/spi/spi-pic32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c index 709edb70ad7d..b8bcc220e96d 100644 --- a/drivers/spi/spi-pic32.c +++ b/drivers/spi/spi-pic32.c @@ -498,7 +498,7 @@ static int pic32_spi_one_transfer(struct spi_controller *host, { struct pic32_spi *pic32s; bool dma_issued = false; - unsigned long timeout; + unsigned long time_left; int ret; pic32s = spi_controller_get_devdata(host); @@ -545,8 +545,8 @@ static int pic32_spi_one_transfer(struct spi_controller *host, } /* wait for completion */ - timeout = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ); + if (time_left == 0) { dev_err(&spi->dev, "wait error/timedout\n"); if (dma_issued) { dmaengine_terminate_all(host->dma_rx); -- 2.43.0