Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1408248lqm; Thu, 2 May 2024 14:00:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIV9gIo/KBqNElUbL9SKckhXesZ1T5akrh0PqTe3Zj+L67ncsiTXaDYmOUdxD75EgdRhpawnWPXVXLl9jTOQhiGmNdQ8E6UXavlbj8Ew== X-Google-Smtp-Source: AGHT+IFhN4d8nC3md8TMUMzPKAyC0yrxwpziy9FkeMkaOHpg/kOm2HZVshUpKYB5J5uzArvpV8Wu X-Received: by 2002:a17:90b:230a:b0:2b2:4c3f:cf08 with SMTP id mt10-20020a17090b230a00b002b24c3fcf08mr1255819pjb.0.1714683656585; Thu, 02 May 2024 14:00:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714683656; cv=pass; d=google.com; s=arc-20160816; b=XVn9H0KHqc+PNHgBSOWX+spLs0k+tbO1Ml8onQbDZ8v7YLphRZ8VW3c9OvSYXV+/q+ KOb0SDqVVuK15cI+Mk+XLIp6JCTsqiSHnGA13XvnXwUkSVB9DIXMAfOJCzQeKnfJGlae sV7tfsGiefbf84GDqUru5VMBBwCyVl3GursfPwh8Ov0WCFLHMLNpZ52OlX0QqJjOvguh PJQiFgZscs8bc0SPBFOGrlwUiIuuCAu/P+P6WCCSBSZygfDyEM6Luk7DchLKcIsqzGGy uWSEJOEUzxManIcUYLjdFFlF1yrFaSSLfR6AkVeovNwgDYKh2Lsit2iRkhb8oHxyE6Ym MOLQ== 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=tOPs0nDGGn0HUpYZAQR6tc6UVzlGp/hbe2nkl7eQS7M=; fh=gdtGyp+86mtZ6LY7SDEyWheDLoVP9eKyBJx3lWN0Lk4=; b=I3VNYFuBbRCD5VQvJ9TTDsxvPoY24toWIhbNpQ7NTDRmph1bcjr1VPT86CoylP3J6n NiCe58GJYQdoAeQ45PD071d8J94yWBD3GGI9WqQ7oGfdSNG1N87mMpKakJVLBd9+UPvF dA/HShc+BltDMzPzsjt78+js9qjXaTNuQkW2H8iCNH1KNMKyFpd8FvSvDdDb7GbtpXTw ADIPfVnF6tBcmqMncmGwq3DiZ9RP8JeXbqNZZsfefKkHkx4BEOwjW4RiniVkIUOAvQSy P873PqbW2wqe5QMdKIhAWs+vY7vYXaedlulm7HqWTo27Sm6pUMqbs6vm0yiOPqr13gxO eysg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=K9Fsn+cK; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-crypto+bounces-4005-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4005-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 rm2-20020a17090b3ec200b002b285de58f9si4180963pjb.178.2024.05.02.14.00.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:00:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4005-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=K9Fsn+cK; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-crypto+bounces-4005-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4005-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 3DB30282F77 for ; Thu, 2 May 2024 21:00:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE196181313; Thu, 2 May 2024 21:00:47 +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="K9Fsn+cK" X-Original-To: linux-crypto@vger.kernel.org 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 8E69E180A7B for ; Thu, 2 May 2024 21:00:43 +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=1714683647; cv=none; b=WLJ+IcMRy/pUC0rjSsyANhKULaFwA9zLKn4rHRfeZ7ZleTXLyuwPrxl+NS4AChq1d39hl8Nmy5fOA8iwD3msnpNN8eMUV/cpsutyk3/3ObSFo6nLoP4Acme3C0B4mlHAuTN6Nh2gyPX9Y3ikXynpkZ2qkyD4JIukCznouKpw8Lg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714683647; c=relaxed/simple; bh=+d6b3FksZbPOKBQGGcwOVwEGil3QNF+ROjxdUMA1suE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OuwwB4mQyB5xRcjk8g/yvrZud2kTZLE0gQDlkLntjIlmI38ZlH4ZBbgfSyTT0g38+wnA2K98ebwBPCBVpGI7ATlQEUYC2hfttC1F11kbXh/v+KMDzB6m7Ha8Td/72AQVe3Z4bhOqV5XFAg8oy16VrKehzGZT7RoSUPupLVJ8jjo= 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=K9Fsn+cK; 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=tOPs0nDGGn0HUpYZAQR6tc6UVzlGp/hbe2nkl7eQS7M=; b=K9Fsn+ cK4+E9DvepSe92HRLSBXVO693S/2nkQF/M3RxGKSLvpMsfMkpG03UtLMpW4lSHhc FvR82+rUw9G74jX0WO3I+9+XAWLOW0olqM0LljTsMIGH0nj1wb4sez8xdhrHt5g6 OcLt/KJWRMVMbbOj35Hz0CXZr4vysQWbDH6Q9/ynXjmUcZTzqNEzC2qRmOP8ERbt S7uJYtjc3Zg0R809MYA7U5FMGH08xd61R1LGGQsUpCjzLMPXYWoRpq+iKfPiE4Ve 5gzmgwxRUU8uyVn6ADCbnBUlX86bVvapr3IImHofXKwZuLKc5lSQW0j45Vc4Xnyu cyRAl0HUJB5cDw+Q== Received: (qmail 3365871 invoked from network); 2 May 2024 23:00:41 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 2 May 2024 23:00:41 +0200 X-UD-Smtp-Session: l3s3148p1@He1V5X4XdIpehhrT From: Wolfram Sang To: linux-crypto@vger.kernel.org Cc: Wolfram Sang , Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , Michal Simek , linux-fpga@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] fpga: zynq-fpga: use 'time_left' variable with wait_for_completion_timeout() Date: Thu, 2 May 2024 23:00:37 +0200 Message-ID: <20240502210038.11480-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240502210038.11480-1-wsa+renesas@sang-engineering.com> References: <20240502210038.11480-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-crypto@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/fpga/zynq-fpga.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 0ac93183d201..4db3d80e10b0 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c @@ -387,7 +387,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt) const char *why; int err; u32 intr_status; - unsigned long timeout; + unsigned long time_left; unsigned long flags; struct scatterlist *sg; int i; @@ -427,8 +427,8 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt) zynq_step_dma(priv); spin_unlock_irqrestore(&priv->dma_lock, flags); - timeout = wait_for_completion_timeout(&priv->dma_done, - msecs_to_jiffies(DMA_TIMEOUT_MS)); + time_left = wait_for_completion_timeout(&priv->dma_done, + msecs_to_jiffies(DMA_TIMEOUT_MS)); spin_lock_irqsave(&priv->dma_lock, flags); zynq_fpga_set_irq(priv, 0); @@ -452,7 +452,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt) if (priv->cur_sg || !((intr_status & IXR_D_P_DONE_MASK) == IXR_D_P_DONE_MASK)) { - if (timeout == 0) + if (time_left == 0) why = "DMA timed out"; else why = "DMA did not complete"; -- 2.43.0