Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp382419lqb; Tue, 4 Jun 2024 14:28:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjhLDuCoHOGYJYCE5Db+gN5RiJp/8z45tSUchE9GrgN53YsduPg3JA3n+SU9FtNhGIvyiHqE/h1ROJY7k35j5JCnKMs4ROOT/16q8kWg== X-Google-Smtp-Source: AGHT+IG36V5CaXgxv2o8rE/eXjwhR31H+v3IZQ4vuTfWQMEj9jvuBnwfT5NUe2AokFrhkuSSeW2f X-Received: by 2002:a05:6512:1287:b0:523:683a:f5ed with SMTP id 2adb3069b0e04-52bab4b803fmr471733e87.9.1717536515005; Tue, 04 Jun 2024 14:28:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717536514; cv=pass; d=google.com; s=arc-20160816; b=SeypnARa6LP8AIvvrAhqDINk/opTgLVETInnfrB+SbD7qxjmsdXNCn3yF+in8nmhqa OE2ZRQxsxZSCvob0puNaaewFnhKyW24NY6ca3DieXm5KIfjEBxAiZ2NIHMGgQGj+JI9/ KvXIsrqRWbrca8u+WPZ+rukhNN9gAt934s5D4w5/AEfpLoBZS/rgpeQubZi92FtbGoYi z+GjYwjyqSz0wBgzwPPZplkNmy2S/j6d02BAtaXhrwtZwsC+5Det5PKD30GJpCKInxHL DFBDfp4W18w3TeEkARL/STQfE4xhejwm5QMWQSIRRo1h4OfLGnBIAQkxziiIhADCK5/h NrWA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=jC1A7HqJFY+HViMGUM45leqfW8NuwjQ3Xmn/k6LDPlM=; fh=X4F5ch7M1obBsKoMxeArfpgYSV1u5frjSgx5ppizCcY=; b=ZTP2Zl9fPaMssUN8ZlTWnINRKC6a7zck8XTbI1p0UsfjWSPQu07UqKhT2K7q3CBrIE BdS67PegyDMoARIYOWcVXxf9HGVy4aNNbcuFbqyn4kDaCsqWKLAagwXcX0g5bCOeGyu/ 4+bYaA4ESb0/QmqHhzvniguJlrLNOgiqgmp53QLI1P6LBHkXkGZ0LrBCG5Xp5tTirhcC ZBIKPMlFuM8mAy7B2FNOoq5Y3UnfasNmyUIEF07G7rJAn+Hwnw/tNCjxGJ0zI9grjYGw nJL+Fb5tHvqY6P4Ucit/sTTfXqUHTNH9yrAfH1zY390imaOkCDzDfMjWBdCSfkJrHoFR 8Kmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=ExaSpfN+; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-201396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201396-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c66c71si5577463a12.262.2024.06.04.14.28.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 14:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=ExaSpfN+; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-201396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201396-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5C3531F21D1C for ; Tue, 4 Jun 2024 21:27:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EF8614BFA2; Tue, 4 Jun 2024 21:27: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="ExaSpfN+" 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 1E66C1422AD for ; Tue, 4 Jun 2024 21:27: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=1717536466; cv=none; b=NO95Q/5tH6u0KaFMmjvbaDTA9hHlpbWkZ/bTNuSTwlNtHj9eShqmbVjApI8sx6fPfNLSU3VErzHf6NW8EqwVAj54ty4upW6ZzyrKdDstMPfTUuYK6QCnb24aN/qLJXEDv6d+BVusXfiKBcYVygGlSFf2y5MP9du6+EFiliCv3Eo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717536466; c=relaxed/simple; bh=lDBJ8K/uPFkXP5dSpZgqFYX0szNdg0uxk14jnd4DaQ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qTfOMaLSx4ZCp5QaAj1C1XEQBNqRgy0u2zpq5dda7yE/kdNHNx1o/Jy13Qo2WL7Z0bKEsfKJMbx3+8D1Dv0RAr7ufQrIRAbzGxEaXvwzhdk9JKC7k+R0rluFRy0EtBBGECyUeBeieAKPl2l2mGIpjspDdZN3dJytXL23Gqysa3Y= 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=ExaSpfN+; 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 :mime-version:content-transfer-encoding; s=k1; bh=jC1A7HqJFY+HVi MGUM45leqfW8NuwjQ3Xmn/k6LDPlM=; b=ExaSpfN+SnEmqFaflt0MPZaIwEKLfB YNE7Z3kefv+ba1Qq03TYS36ogHQ8tIxWehG0uTK9O3Uf+/YE5FF9/43QPp5GWNRy eAGaFtYfqxh9VqJH1CKW0jHuaU6RGUFAegG1P0gW8MdcnKTp8BLGcLklH9ocXmgC 3bOJByoWHNV/kIqU2JVeawKWLmMeyBnZIpKYQGvnTgoLLmVQs4c1+0G9eet5xZKS I2pU/SXSsFgD1ap0EvCrHbFBdmt2zMApWv7z81IDzWmywJy8G9VB4Ef+Npdluszu /V68lrQbtgt2Fsems0wQwrxQLhI53Ng+iDHvKNeSiU3YN+xPLctVyfnQ== Received: (qmail 2450558 invoked from network); 4 Jun 2024 23:27:42 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 4 Jun 2024 23:27:42 +0200 X-UD-Smtp-Session: l3s3148p1@/C6yHhcaiKtehhtB From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [PATCH 1/1] usb: typec: tcpm: use 'time_left' variable with wait_for_completion_timeout() Date: Tue, 4 Jun 2024 23:27:31 +0200 Message-ID: <20240604212730.4968-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@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/usb/typec/tcpm/tcpm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 8a1af08f71b6..e46148c19be3 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -943,7 +943,7 @@ static int tcpm_pd_transmit(struct tcpm_port *port, enum tcpm_transmit_type tx_sop_type, const struct pd_message *msg) { - unsigned long timeout; + unsigned long time_left; int ret; unsigned int negotiated_rev; @@ -968,10 +968,10 @@ static int tcpm_pd_transmit(struct tcpm_port *port, return ret; mutex_unlock(&port->lock); - timeout = wait_for_completion_timeout(&port->tx_complete, - msecs_to_jiffies(PD_T_TCPC_TX_TIMEOUT)); + time_left = wait_for_completion_timeout(&port->tx_complete, + msecs_to_jiffies(PD_T_TCPC_TX_TIMEOUT)); mutex_lock(&port->lock); - if (!timeout) + if (!time_left) return -ETIMEDOUT; switch (port->tx_status) { -- 2.43.0