From patchwork Thu Jun 20 18:25:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 13706241 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 20EC8C27C79 for ; Thu, 20 Jun 2024 18:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=xu9VOzRmG/UkvnDAdBmyNxlTOb4JvVACGdu9+nf9yM0=; b=QIsSQUmPGoenny1IU+usHuRp4L nPkib2wLTioylcZC2dG0Q9wIhhBCCb3SLRKHzGOvsTOqD4lbbJ5SWjkx/Kta88D55YqnwUTOiFNBD 5WbaGNxZu/CYlcuEiRwxcK7FktkHOb1J1BxzTVg9RorlpDUjp/dNZuaybq0Iv9Dii27Xh0qAJOels imWrS/1TAeOsiWPO+Goql6JjcwmGXPX1kHOoo3b9/w8brYkZiosy2l4ISOTNW8yMMNEs9XBcYUb0I 4+Jb3JjVLcpjnAmJLgrEetI9OZNTIHr8jyN6mNCRPeTETZL0y62IUgC11WKZpKIjHRbC8whb5pent r2O+GSSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKMTq-00000006Ii2-2GAv; Thu, 20 Jun 2024 18:25:54 +0000 Received: from zeus03.de ([194.117.254.33] helo=mail.zeus03.de) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKMTl-00000006Ifs-0oxc for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2024 18:25:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=k1; bh=xu9VOzRmG/Ukvn DAdBmyNxlTOb4JvVACGdu9+nf9yM0=; b=icgdqprhF8MN5jUYmbIwlIO9d9kwyJ JJiYUdhhs74r8S+vkN9vt5btRfPM5uxPlo81RWKGd7PBu4MvVyzeKKDz/xB5+OZr FdvIChy19OUzjtRSb7g2vmPZuOcfwNdkS2nRYTYecMeep3PjFJ+eJx/lD3Z2Subx VooeZJ1O6SpQdtUVdq49ccHDg7ygwGEsum05ptBCkv70fwvsG2H+I7o9iRe5RS40 gncNWR31w5NUQDkr6MFIEkxCpe52jlZ9nKJRIS1NYda097GnPyzNQoGbLuAKaD+P BqS9pXs//rAuQpqEaXLPFmb9qeVWYf2nK+jqdzvHjIN2pFCkH2RHTitw== Received: (qmail 1109850 invoked from network); 20 Jun 2024 20:25:44 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 20 Jun 2024 20:25:44 +0200 X-UD-Smtp-Session: l3s3148p1@I+VvcVYbgrhehh9j From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Greg Kroah-Hartman , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] staging: vc04_services: use 'time_left' variable with wait_for_completion_timeout() Date: Thu, 20 Jun 2024 20:25:38 +0200 Message-ID: <20240620182538.5497-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240620_112550_213804_030B653E X-CRM114-Status: GOOD ( 14.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Stefan Wahren --- .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 8 ++++---- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index b3599ec6293a..deec33f63bcf 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -591,7 +591,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) static void stop_streaming(struct vb2_queue *vq) { int ret; - unsigned long timeout; + unsigned long time_left; struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vq); struct vchiq_mmal_port *port = dev->capture.port; @@ -636,9 +636,9 @@ static void stop_streaming(struct vb2_queue *vq) v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: Waiting for buffers to be returned - %d outstanding\n", __func__, atomic_read(&port->buffers_with_vpu)); - timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, - HZ); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&dev->capture.frame_cmplt, + HZ); + if (time_left == 0) { v4l2_err(&dev->v4l2_dev, "%s: Timeout waiting for buffers to be returned - %d outstanding\n", __func__, atomic_read(&port->buffers_with_vpu)); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index fca920d41e4f..67489c334f7b 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -655,7 +655,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, { struct mmal_msg_context *msg_context; int ret; - unsigned long timeout; + unsigned long time_left; /* payload size must not cause message to exceed max size */ if (payload_len > @@ -693,9 +693,9 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, return ret; } - timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt, - SYNC_MSG_TIMEOUT * HZ); - if (timeout == 0) { + time_left = wait_for_completion_timeout(&msg_context->u.sync.cmplt, + SYNC_MSG_TIMEOUT * HZ); + if (time_left == 0) { pr_err("timed out waiting for sync completion\n"); ret = -ETIME; /* todo: what happens if the message arrives after aborting */