Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1959058lqa; Tue, 30 Apr 2024 04:44:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUa3L8lAfK+8k6lu6nMUKQLeS1TG7VTKJjhVMQ6CUATiTvXkbzlYs/GAQteUmFB9wVWtLqsIVh0iyfBZz8SK27k+v9cLbUB+B8TzR7UbA== X-Google-Smtp-Source: AGHT+IEoE/a/SEJ61xRTu7WJP020kxXjNjvSwVqUbnG2Oo6VqQP4dPE+ex7JSPuUqsE5jjusZhhb X-Received: by 2002:a17:90a:af88:b0:2b2:813e:a88 with SMTP id w8-20020a17090aaf8800b002b2813e0a88mr1671662pjq.7.1714477469218; Tue, 30 Apr 2024 04:44:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714477469; cv=pass; d=google.com; s=arc-20160816; b=zJZR+6PMXwKbnBjFNwGtskc62Wuh9X3d+S/1OhupGuUYVtqxFNUZWHWJg6WViyKmNA sbSc/PEUftVcIbLWt7bDh+r46Wuz4RPOuxDJ/zknRM7JfKWKGmqYjieeldXn+L9VcFzV /HBGWbFtNQf2pdQ3sGJ+OlqbYqDppWpD+GWEqIzKwx6QW1ok5LNCHe8kw+upeCAC2iyB oz2WxWTIJ83aOgYDoRH8q8VjtBiJJ0LuNoNr0L+0Fy7Z+ylsRcDxqppbvYeWRn6KFs++ h57Omn2Pn1nMz2dte9w5Ip4aLnYeeo+4406DHjkj5XiC1wUpM9eTFK87wJc2VWQMThIf eF7A== 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=QSKeK0isKUrZRHFQeVEM2xYZKBtP1xN7MAYYmt11wmo=; fh=HMmm4U7AbdvcJIoeDg7+Ktu1WvLDOfwmyLifKtq0VWM=; b=q+c4vMHGDAWNYVxMtjpxpYEIk2XHyEfrk8rWDNxiQOAmOUt8dmN2iUN1NA9pbj9RwB /+31sn49t5Uz/DsQr3n+JMt2cwFiDjMHfqr5vzHXrjk6Xi8MOM+NzdOFWEAU3KOUmj5h qK5j3CCfEUr9f/6VsJHdByEsg50Hl/Ql7kPDcNhGFf1LO0eS9irPpjLkmAENQH3wef8V DTmirothZMJPqQedoJP929EFJY5yC6S9HoSMGoGMqS3OxaY2rTlIIsDBaFhBssGKulcQ YtUyBKSgXl2CVU61uTzHiytLQermMvHmbPAfHyZHJJeoiV9NYoWfdl7P7ystvyG6ZTFE a6YA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=cp4YYHTb; 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-163862-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163862-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u11-20020a63140b000000b005e46d335070si21315154pgl.203.2024.04.30.04.44.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 04:44:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163862-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=cp4YYHTb; 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-163862-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163862-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 84F812857F6 for ; Tue, 30 Apr 2024 11:43:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40707148FE2; Tue, 30 Apr 2024 11:42:01 +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="cp4YYHTb" 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 AEF1314037E for ; Tue, 30 Apr 2024 11:41:58 +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=1714477320; cv=none; b=mbsiz793oR9swQ1nOLZHtLNhPVWY3Hzs8Sy/IVLlDU1ghcBR4H2RXw/upFwfqgaxFBaexnBAxwsxPgsJElxhIxGrE5scIYaEUQpYs5MPGRdZpyee+K0FpHpTbuRJvCc5HCWSo6FDWdOODnPoMjEOTwCpFxfGYEs0nsqLa1S53RI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714477320; c=relaxed/simple; bh=MqlEzg2jbLKX7b5U4n7ik5lIo7ox8YuJe3H75yyVnR0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fEQ0T2t6f2dxUB2QWRZKdDq+LVvdZ47oWIFMjbVsqEa0J/iUnbo4MC81XVd9g6MA2NoqGOfOkHtgMw35/H4MbweYXSNgvEwH8t/cm2gFly11G3VbWlRbaiG8OxmYTa8A8gVnslma7ecSUTWmIbezXjyZBcz5/j7vE1ShMzIP0KY= 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=cp4YYHTb; 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=QSKeK0isKUrZRHFQeVEM2xYZKBtP1xN7MAYYmt11wmo=; b=cp4YYH TbTJudf06wF5eH8m20CcvujSbPUeyhp6b+7biQIB+tM3ipArocFXGfV3R+dADOi6 Li848d30UqayJuqft6Rbi9H/DE5Pds3yP7KVC5DbKMe0iapP3tQyDSnumNtCJeu8 FBkadZMt6r5jT8Canoh0P2QeCA+vz/hR3T3ngFT0J1Al0BjdZR1laWeyaIoIqWxt YzDvyRLBDJWYZYU/PuSd2weXGZxaAf1E2UC5RfZaRmyzzByUvsgLCFk2MzM7KZsd SvWVjpjfFEfO71dKLa3JiFAEXpSvFsFy3b8JqQpwPwXFtHMtdDfc+ZisJzv0algg 9gDVIlQVsupZCIeg== Received: (qmail 2617945 invoked from network); 30 Apr 2024 13:41:50 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Apr 2024 13:41:50 +0200 X-UD-Smtp-Session: l3s3148p1@u9IL204Xxpxehhrb From: Wolfram Sang To: linux-spi@vger.kernel.org Cc: Wolfram Sang , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH v2 8/8] spi: xlp: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 30 Apr 2024 13:41:40 +0200 Message-ID: <20240430114142.28551-9-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. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang --- drivers/spi/spi-xlp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-xlp.c b/drivers/spi/spi-xlp.c index 49302364b7bd..2fec18b68449 100644 --- a/drivers/spi/spi-xlp.c +++ b/drivers/spi/spi-xlp.c @@ -270,7 +270,7 @@ static int xlp_spi_xfer_block(struct xlp_spi_priv *xs, const unsigned char *tx_buf, unsigned char *rx_buf, int xfer_len, int cmd_cont) { - int timeout; + unsigned long time_left; u32 intr_mask = 0; xs->tx_buf = tx_buf; @@ -299,11 +299,11 @@ static int xlp_spi_xfer_block(struct xlp_spi_priv *xs, intr_mask |= XLP_SPI_INTR_DONE; xlp_spi_reg_write(xs, xs->cs, XLP_SPI_INTR_EN, intr_mask); - timeout = wait_for_completion_timeout(&xs->done, - msecs_to_jiffies(1000)); + time_left = wait_for_completion_timeout(&xs->done, + msecs_to_jiffies(1000)); /* Disable interrupts */ xlp_spi_reg_write(xs, xs->cs, XLP_SPI_INTR_EN, 0x0); - if (!timeout) { + if (!time_left) { dev_err(&xs->dev, "xfer timedout!\n"); goto out; } -- 2.43.0