Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1080809lqj; Mon, 3 Jun 2024 09:32:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQdUp5n2oQ3bPRpYFfBKm86nTm9OsLT0AM8jP59uA8XtExxJOmGnXhyoYvM+zQcPz2gDc16WUznmcovOOWpLB9qNEgVu5BkIjuGqK7kw== X-Google-Smtp-Source: AGHT+IH4mQ47FWJjQJpglA+eW1pYGQvctzBIDXb5SJW6qRw4I+C2o4Fw68WFRtZgt3/fJmTIxF67 X-Received: by 2002:a17:906:f152:b0:a68:cb91:f98d with SMTP id a640c23a62f3a-a68cb920457mr374750066b.37.1717432338097; Mon, 03 Jun 2024 09:32:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717432338; cv=pass; d=google.com; s=arc-20160816; b=xTshlFjZJKA7VWVOBt1LaTNgCEzAZ/dIl5S8F8lYVg01v8sdED9Qvo2oZxGW6FSQKz ahqbtCFx+HLjrlGBHN0IRHyX0cf+bt4OytIi+H+5Mb69RAxaWcNgRv6WgfKNxBEe8vke UnSuK0rgSXFLj2JTb56u9tR7ATUWnzhkBl4z4CUYlVbdTEy5iXTqkknZeVv978iW2nSe /rtkyWn50xsVDb2rIv8p/lcQkXI63bqfEBUgUnvFB/UQ+UP+BIaUlXOg2WAJJVbcvrt4 b0Szxzha0mB8F+j+rWj2XdBdN2dGuF/HnwHNlBcUJHIYmPX4Wi8x68uISx1GeLoZflr1 WiHQ== 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; bh=/J8j889MmbX9qBuk/TBisMWxdHutwAStqEiFhx7ca0k=; fh=rldNpSZdIVm09os20YUTk4jMKDSQl5EF+TqyTq4TECw=; b=IlYKGW93kVvAtIbgLdBXlQVbVp5TpxxW8jBJCalH8LQn14lTasI/HXvL+OSQf6qfJk wi0z2UNn5e7BZh3MFgXAeI8eU8i9orf6/3K/OyAyoFqij+8Baa1N1+T+JYASc34VDCtt 1Xv7lyVGaq1ddgT1vSRFgp5huTtjFhdtrdpL+U5zLSqv9OUubb2TeBYFkPOUab1UR/xZ B837OUShmh6RGnawMRISakF7D46KECQKh/Qi22xPY6YZEZow/+kZgDPuM/BviHbBREs1 IwOg0foi7nV7+Oocomk2YeadtDJ7x9LjiQm1pGGNN3dG1WZe/fikJN3o3kNvzquV+zk1 3jLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=iodev.co.uk dmarc=pass fromdomain=iodev.co.uk); spf=pass (google.com: domain of linux-kernel+bounces-199447-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199447-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iodev.co.uk Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68c6d375b2si252608566b.992.2024.06.03.09.32.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 09:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199447-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=iodev.co.uk dmarc=pass fromdomain=iodev.co.uk); spf=pass (google.com: domain of linux-kernel+bounces-199447-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199447-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iodev.co.uk 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 am.mirrors.kernel.org (Postfix) with ESMTPS id CCB211F21882 for ; Mon, 3 Jun 2024 16:32:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C81813699A; Mon, 3 Jun 2024 16:32:08 +0000 (UTC) Received: from iodev.co.uk (iodev.co.uk [46.30.189.100]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FAD27E8; Mon, 3 Jun 2024 16:32:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.30.189.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717432327; cv=none; b=DlJ7dOKXa12vgFMEVZB0mrSmT6YxZQRPhDEU02ov2NHkNpHlG0KscNPoBNNyYwQo8oVvCzt8tIBlRE3CuA/sI/Uo90LusWu+mM3D7G+mH4iruBzUrbNgPOawyx/3GdlGN0aA+niHP9/sOvYEKbG6G6pngwIPpqh81qECOu8LwYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717432327; c=relaxed/simple; bh=n2MNycYzLz0lakSHL4JSDI/HsK0K7GI2jUwG3ZDFX9Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YZ0G1aIbC1AwK3GgamYI3pp6hsXVlQZBD6ao/oKvMeOJoOuTJZK1V+EsNMQU7YhFhcfVYPcjN8tungLypmxgAoLntQHVqM12GtZQVSPuqXrzw2EJ8o2rwSJdao+Aj4Ao3nZ4JCaJmzoGCubjA2tsSFKNuxnMNSlF6Gf1NX18MXo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iodev.co.uk; spf=pass smtp.mailfrom=iodev.co.uk; arc=none smtp.client-ip=46.30.189.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iodev.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iodev.co.uk Received: from pirotess (222.red-83-46-228.dynamicip.rima-tde.net [83.46.228.222]) by iodev.co.uk (Postfix) with ESMTPSA id E11952EF94D; Mon, 03 Jun 2024 18:25:51 +0200 (CEST) Date: Mon, 3 Jun 2024 18:25:50 +0200 From: Ismael Luceno To: Wolfram Sang Cc: linux-kernel@vger.kernel.org, Bluecherry Maintainers , Anton Sviridenko , Andrey Utkin , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: Re: [PATCH 6/8] media: solo6x10: use 'time_left' variable with wait_for_completion_timeout() Message-ID: References: <20240603092841.9500-1-wsa+renesas@sang-engineering.com> <20240603092841.9500-7-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240603092841.9500-7-wsa+renesas@sang-engineering.com> On 03/Jun/2024 11:28, Wolfram Sang wrote: > 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/media/pci/solo6x10/solo6x10-p2m.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/pci/solo6x10/solo6x10-p2m.c b/drivers/media/pci/solo6x10/solo6x10-p2m.c > index ca70a864a3ef..5f100e5e03d9 100644 > --- a/drivers/media/pci/solo6x10/solo6x10-p2m.c > +++ b/drivers/media/pci/solo6x10/solo6x10-p2m.c > @@ -57,7 +57,7 @@ int solo_p2m_dma_desc(struct solo_dev *solo_dev, > int desc_cnt) > { > struct solo_p2m_dev *p2m_dev; > - unsigned int timeout; > + unsigned long time_left; > unsigned int config = 0; > int ret = 0; > unsigned int p2m_id = 0; > @@ -99,12 +99,12 @@ int solo_p2m_dma_desc(struct solo_dev *solo_dev, > desc[1].ctrl); > } > > - timeout = wait_for_completion_timeout(&p2m_dev->completion, > - solo_dev->p2m_jiffies); > + time_left = wait_for_completion_timeout(&p2m_dev->completion, > + solo_dev->p2m_jiffies); > > if (WARN_ON_ONCE(p2m_dev->error)) > ret = -EIO; > - else if (timeout == 0) { > + else if (time_left == 0) { > solo_dev->p2m_timeouts++; > ret = -EAGAIN; > } Signed-off-by: Ismael Luceno