From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E632C4345F for ; Mon, 29 Apr 2024 15:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bWd3PNUpsyih3V6+IzGk7eKx83VdQBsL/W4ee6nAqOw=; b=JDJDDgLffZzTEN IAzDfWqoQ6whgzBcUtWXDR9CXCLCPEWvOVPS+nS2FsWP+6blyZP6K+Dl8/wRgU9xzoTtoP/LPuo0A F7hiwK3tPipy05MGNgvLZ/uxJar7S3QWYxBB6V5csVFE0Pb+n+suI4VzJpbBAwWCvUd3A+a4Trs16 bphj+4lItbJ7xf6zfQKRVTr0QNVwoOvSKe6MbmZWKxhasnCU4hlDqYOy4VA3lQwpcJIKsTSFnOMT2 R0VBDGnbMHiBnC6501xCz/3U6BAnkHMew0/ym5Pr49zgX3je3V9l07jkLuOl/hF2dubTRoDI0hIQS bKBD+SzGkAyhmlv/ErvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Sn5-00000003Mtu-0J2d; Mon, 29 Apr 2024 15:19:39 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Sn2-00000003Mru-19z7 for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 15:19:37 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5708d8beec6so5737275a12.0 for ; Mon, 29 Apr 2024 08:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714403972; x=1715008772; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S9C3JVcEDpwsOADlHUtbqCqSAuCy7fwWOq+zvdoWz3k=; b=BnZL9J9M9Px8xLp2dRmk2I+e1Q/Gz/J5h2/q4ADV1UeHiz1PQXL4y3vHJV9eyjquZ9 dPTuYsOvYPyTmS6B/ncWhwzXQe3emquOC7b0y7JNWrD52tVnMD4C6wJ73iNk8bYMjo2K 4VMY4Hu89rU73Xq1nDFhCCUOmUeYmQhDs8lrO8g44j2n5kXx3BJUGrX7W+hL46sRfkjZ mCCn6YqycZcmwk5CqcK91qyWlcWM4BbAAVTFPzBFOEjFZJ8Ip7n2Pi1Wd89LqsrLVHPy DkPCbJ2VsskmkuAZzehB9MKP5uyHt1+l+QxTLkFY6pQFx+z8Wi6GCyQITD2tls7gilnR B9rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403972; x=1715008772; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S9C3JVcEDpwsOADlHUtbqCqSAuCy7fwWOq+zvdoWz3k=; b=t7lWSj2JZiHCYGw+cRHmvlN+Dv6ahV/UraZpMjtp30NunbfqB6uI8wVwyyJ/7CVnbT TZ+J9O3yQa5UhfOlUGITNf/izelbWP6HBJ337LpEr99c+oBfm151p1oNLvB5mnnBPhXP KpfTSRje/QXYPJUY65x5XN8K8mPuwbi7K2jV37c41Vz7PIGW2DvqLbLpYBLNQZzXCpO8 /fA4AM2o8ItNm15I+e+BKYZTyVwOQUjgC2lfKdHNBXz/YIyZ5D8dnFTaXRwaDdqO5WcC 5Nyfr5hYFp7P/7Y4UUgkAiUyajeNPZxVW6zffxjumrAgfu7f+VtWPoBCCOXNMlyXk9np SmPA== X-Forwarded-Encrypted: i=1; AJvYcCUFvKUlhZG1EwmUezrV+ko4Ffp8ORe4zPK3/KPxHCLdbi8il0st+KDX48BVRrkTHZMihBW8oPGfYYs00rFmi0iKHVMJlXcTp8Ogr9rTKbKDGpo+h/4= X-Gm-Message-State: AOJu0Yy5UnlQX1H4UAB2vlBiJb1RCQp6CIopsxjZ3P78+bFVQEwiOVym WnOquiFm/4pxJ6S3qJEDGHgAeQ9Dg+O3VOHQD/9j2MB8C2BpMnhz X-Google-Smtp-Source: AGHT+IG9T5aL2XPvLCDwTfqYe8F/ZRUPCN2K8XAmythmr2DqFYhUB73oLbiJ/x39cBvXRLd32dGw9g== X-Received: by 2002:a05:6402:1d9b:b0:572:664c:83f2 with SMTP id dk27-20020a0564021d9b00b00572664c83f2mr5493405edb.27.1714403972190; Mon, 29 Apr 2024 08:19:32 -0700 (PDT) Received: from jernej-laptop.localnet (86-58-6-171.dynamic.telemach.net. [86.58.6.171]) by smtp.gmail.com with ESMTPSA id es21-20020a056402381500b005725c56b35bsm3568025edb.71.2024.04.29.08.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:19:31 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: linux-spi@vger.kernel.org, Wolfram Sang Cc: Wolfram Sang , Mark Brown , Chen-Yu Tsai , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/8] spi: sun4i: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 29 Apr 2024 17:19:30 +0200 Message-ID: <4560843.LvFx2qVVIh@jernej-laptop> In-Reply-To: <20240429112843.67628-7-wsa+renesas@sang-engineering.com> References: <20240429112843.67628-1-wsa+renesas@sang-engineering.com> <20240429112843.67628-7-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_081936_350699_3ECDD601 X-CRM114-Status: GOOD ( 18.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dne ponedeljek, 29. april 2024 ob 13:28:39 GMT +2 je Wolfram Sang napisal(a): > 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 Acked-by: Jernej Skrabec Best regards, Jernej > --- > drivers/spi/spi-sun4i.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c > index 11d8bd27b3e9..2ee6755b43f5 100644 > --- a/drivers/spi/spi-sun4i.c > +++ b/drivers/spi/spi-sun4i.c > @@ -206,7 +206,8 @@ static int sun4i_spi_transfer_one(struct spi_controller *host, > struct spi_transfer *tfr) > { > struct sun4i_spi *sspi = spi_controller_get_devdata(host); > - unsigned int mclk_rate, div, timeout; > + unsigned int mclk_rate, div; > + unsigned long time_left; > unsigned int start, end, tx_time; > unsigned int tx_len = 0; > int ret = 0; > @@ -327,10 +328,10 @@ static int sun4i_spi_transfer_one(struct spi_controller *host, > > tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U); > start = jiffies; > - timeout = wait_for_completion_timeout(&sspi->done, > - msecs_to_jiffies(tx_time)); > + time_left = wait_for_completion_timeout(&sspi->done, > + msecs_to_jiffies(tx_time)); > end = jiffies; > - if (!timeout) { > + if (!time_left) { > dev_warn(&host->dev, > "%s: timeout transferring %u bytes@%iHz for %i(%i)ms", > dev_name(&spi->dev), tfr->len, tfr->speed_hz, > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel