Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp195509lqp; Tue, 11 Jun 2024 01:17:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWO7jDbgV/RLeLn1nQ8+tO969GVk1C2WJDBjOZpURinl0zIJovSuiEGgPkbfpE/MoeztmC7ejEd4HcnaUPgQUWncB+lZ9rAAzCye1MWjA== X-Google-Smtp-Source: AGHT+IHoouuzTvFdLZ1Xme3Ke6OlvE9E0ksPOJ5pU/t86F73DvQg0jGsGJzHZGxmDcCWQc9WG7n5 X-Received: by 2002:a9d:7b51:0:b0:6f9:cf25:d70e with SMTP id 46e09a7af769-6f9cf25de21mr3667478a34.23.1718093869873; Tue, 11 Jun 2024 01:17:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718093869; cv=pass; d=google.com; s=arc-20160816; b=aS6xJTmKMmvZAcoxg6VqkuurRDHEupzCtVg1HQZ9UvPVmyh3wY13nJkvn7EHcRZmBi qqqIxx2w8sb1qJPu9n9hSmWF9RJ3MX4GF1Ed1ZfTT+pz1VfMR38dvc88MVYQQSPECf9e iw61mHEefBQUkmfcfkF8jarW47oq4/RA1JL2FosKvDU8E4gTcLduqvj8I1DbElCSpzSm gsNyEkmmrQK4t4Z+RMHI+oPytw7r6W9DekWFOMRN2RWkUtS9BN3gqPnnkJY/9cchrd/P b5kXq7czL8eSAXRmM1RawqBkgxmOZmVgN2ad88SbzpNT4yvweK52du/YbnFQlv4CMp2/ meNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LFisGPVhknP7CN7ic0vAqX1DiG2yPUQk1Ugtkf2snzU=; fh=uqNiig3UH2mUgsXet55BIo/xPE3/7rkF6FZKs/WYgsw=; b=j+ANJWr2ko+bk7yct9ME+y+FrRtfnSEGb12/7+8Fi9n1PXIrDy+wwzh5VKE9jTEgub i4DcggIXVfKQ6ktWA5fbGDJuq/weu3URSiBuc6tUJzNAFbJTbiLp7YxGx9SYM2M6+XQ/ 0NioJPxTtlC3b34uwoP+5k181xGjhcmG30q5hrqg9m0tNZOipXA5fTBrvRyv48LnudOY xiluOaQQOs2DVq/lXgx9te2tb6So7FoOWSq93uRedOYLNv/oViZkvjFk2uGllBUEKaLp +0W+8uGTwaxM4BKQUlJxKcvD8uY+Pv0McIKGPCxmbthwLbhnqkcttTnXL/u5gF+Oe9ca ZrEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kTA8umuq; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-crypto+bounces-4891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-797a80c9c52si258769385a.301.2024.06.11.01.17.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:17:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kTA8umuq; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-crypto+bounces-4891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9670B1C20D71 for ; Tue, 11 Jun 2024 08:17:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 199CE174EFC; Tue, 11 Jun 2024 08:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kTA8umuq" X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 15E26171075; Tue, 11 Jun 2024 08:17:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718093842; cv=none; b=drZtHqqNGfNGFZXcYI4LMrJ7CUBfvnMsYwgdqhyy3tfedpfSJCFos28E8UKX3wowNCU2Zh18jgb3aPa9E66e575ciVPin77CqdjTT/IlVa/DqaffJJeslwx4wqN11vsO4RiJEEYrWdcl8M3BgHABNZSOLUoWCm745Utp7f3unUA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718093842; c=relaxed/simple; bh=IYRrcBe4GylyFRXsIQPGJ9H2aZqm92cfOkhCwvHZWC8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FaoAt1/WkttSvdnKxXs+XjP/k6ZPnKLAxDM3Gqxjigr2hXVb3C0dRxJgJOPsTUTJdCrdGfTxJ59RUx6+NNVraXpolbpUzo17QxHc7qD//EO7Z1drd00mg+a2Dq7EvxKVOYaG//tO9KrT2hoInxXNV+3pGboexKiHjF3vBkvMfKA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kTA8umuq; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718093841; x=1749629841; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=IYRrcBe4GylyFRXsIQPGJ9H2aZqm92cfOkhCwvHZWC8=; b=kTA8umuqEAL3oM7QjbXCKpLLaTTbBpc9ksK4x1+xqPD/VIl6Km7YUxVu OCs26Ay4upI7aWBu1VfRYkMM25CRA5PG6EyzwLZ8fh3TTVhsDzATGw3Ix aluTqt7o+InpVT5JwcM7vVvI2eaC7sXKJjcykpIMdiLO2EyCQM/NC4Rgq tvrBUlfCkFPrm+bpPhqczrPWwq791Bm6sfhDqljYzUEKxV1ZWuCV18uM/ hWXPCiYrESa5EkOpG50bCRSg/wgo5hm5/dopy6ewx6Qx3ZA1HcZR0hFAg ehM5qH/CBrHUsy2/TawO5xq2Igepsi2Z6dosOucf9FoDNAWEbaC9AuXbe g==; X-CSE-ConnectionGUID: mh+4jld/Sjqbv2R6sCkAFw== X-CSE-MsgGUID: bb/ypK/iSLOq9UHcwsSz7A== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="25368068" X-IronPort-AV: E=Sophos;i="6.08,229,1712646000"; d="scan'208";a="25368068" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2024 01:17:21 -0700 X-CSE-ConnectionGUID: ghY+OA50TGeJ0lirHyCfrQ== X-CSE-MsgGUID: ltE0LWriSfSBxd/pHCg9vQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,229,1712646000"; d="scan'208";a="39422866" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by fmviesa010.fm.intel.com with ESMTP; 11 Jun 2024 01:17:19 -0700 Date: Tue, 11 Jun 2024 16:10:50 +0800 From: Xu Yilun To: Wolfram Sang Cc: linux-crypto@vger.kernel.org, Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , linux-fpga@vger.kernel.org Subject: Re: [PATCH 1/2] fpga: socfpga: use 'time_left' variable with wait_for_completion_interruptible_timeout() Message-ID: References: <20240502210038.11480-1-wsa+renesas@sang-engineering.com> <20240502210038.11480-2-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240502210038.11480-2-wsa+renesas@sang-engineering.com> On Thu, May 02, 2024 at 11:00:36PM +0200, Wolfram Sang wrote: Sorry for late reply. First of all, please limit your subject/shortlog/summary within 70 chars. > There is a confusing pattern in the kernel to use a variable named 'timeout' to Please make the changelog line wrapped at less than 75 chars. > 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. > > Fix to the proper variable type 'long' while here. > > Signed-off-by: Wolfram Sang > --- > drivers/fpga/socfpga.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c > index 723ea0ad3f09..b08b4bb8f650 100644 > --- a/drivers/fpga/socfpga.c > +++ b/drivers/fpga/socfpga.c > @@ -301,16 +301,17 @@ static irqreturn_t socfpga_fpga_isr(int irq, void *dev_id) > > static int socfpga_fpga_wait_for_config_done(struct socfpga_fpga_priv *priv) > { > - int timeout, ret = 0; > + int ret = 0; > + long time_left; Please use reverse xmas tree when it is easy to follow. The code change is good to me. Thanks, Yilun > > socfpga_fpga_disable_irqs(priv); > init_completion(&priv->status_complete); > socfpga_fpga_enable_irqs(priv, SOCFPGA_FPGMGR_MON_CONF_DONE); > > - timeout = wait_for_completion_interruptible_timeout( > + time_left = wait_for_completion_interruptible_timeout( > &priv->status_complete, > msecs_to_jiffies(10)); > - if (timeout == 0) > + if (time_left == 0) > ret = -ETIMEDOUT; > > socfpga_fpga_disable_irqs(priv); > -- > 2.43.0 > >