Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp556623lqa; Sat, 27 Apr 2024 13:36:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0BHbp4Itwln+vto1C5yZDyEGprIE1X0vpzXOBKL6ZDGenZ0nfD33b4Ww3s2Y+qWdWEz+QfP3K+bULm8NpgWIR839akbPTIT1NiEGNIg== X-Google-Smtp-Source: AGHT+IH8rg8+ak6NsTqOUu4yT9I8+GRx/Q/f5uUQuJ52lNWuwWciFu0TDbYEY0sMsFMVPh3WshHo X-Received: by 2002:a50:8a89:0:b0:56c:d35:1775 with SMTP id j9-20020a508a89000000b0056c0d351775mr5432184edj.35.1714250201363; Sat, 27 Apr 2024 13:36:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250201; cv=pass; d=google.com; s=arc-20160816; b=WnaFSI4HLEwvZ9NPgb7VLzDT4Xku38tsURKiJnZAIPzeXbbmfsbV5Ep3K6JIkit1D0 hqhiALKqTjeaw1IOBnzT/MIKwsNbm738JULHu/g53aIy0zH8JkX58CtrvFLRMTs2hxyi CRc2tveSGF2WZIHsdcELXsMDK1vtgc6XNuRKLII7xDEWMxKqM+bXhCYNdZJrLiQv9/b5 MImKlF3t1nXxMon5h1u4Zxb24wJA2OXAuLooJJpYi8HgzSUlEm6uzJG/p8bH1w3FbHco 5VlxwY+pFHEfF+McVy66ijPAncsIPR5TT7oLs0jPH/ZEWLGNDakprrNb3xhpzmZCeIyo jxyg== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5CaGINr/VQqkg0HtDZ9KeFK/+9trW1V6dMyw4Bgc270=; fh=Krxc5qk77IOrBvfOxa1pexOuiZ7x3QH6VZHnug2UuzM=; b=Tw6oiq3Ekta5AAKNdseoIjRqWrXyJoBqPDiyHUm9ceqMxZEgtLB9sp5oekTfjClk68 Xp4FIJRxHcbckKA6uIFZ4xBHbMG3IJF0RyAfsxpRQMUtuKkIrBRZAu31fk8cA3lsuXPx pzfsgMaGxW3iZDgd9JM8PD2TnYWsta00Y5pWj4vSKffHqrgfnsRnGoHvWsBkQ837DT9o kNzGZJgkoPZobXF9YgnZWSbJKavrXEQgdRRe7DU2sSmeILzGZa6+jLKEfpMOcFwQxAyb cu+YRVCO52OcF5IsJWw5+JQg+0Da8JLePIPQ4bTHLxNYEvA9B2lxb2RzKbChqjQCnAci SlVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=lY3a4uzf; 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-161168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161168-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c88-20020a509fe1000000b0057269367116si1250519edf.303.2024.04.27.13.36.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161168-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; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=lY3a4uzf; 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-161168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161168-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 1E6E01F21744 for ; Sat, 27 Apr 2024 20:36:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C74D1145FEA; Sat, 27 Apr 2024 20:36:21 +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="lY3a4uzf" 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 DAC5123A6 for ; Sat, 27 Apr 2024 20:36:16 +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=1714250181; cv=none; b=mBQFWKF5qfiwLlqsZxIo09UNZzJ+vEBd0y+MYrBUSh3sYMVZCL+BI4QpbnYOCTr1/Hrtf0c9GdV7t3qoaZ0A/ppFWzzRfTyc8pk2Y3hqcUQecsh1bAyAI5mKpA5ZW++nxOVJoarLRU8PyOQKb3nXNpMeN5wiVSXV/XEsKCW1Xsk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250181; c=relaxed/simple; bh=WrCXJ1CR/Fi/XZH8dRI39xCZyW9nwXbeXRXPF7QQjI0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XNwfuvQm5bLHrOTMN3ShXvROONTaKrEUd0hyZ+cf3T+bE4suINwGcLaAOT+hfOzjvs+KW73JTIacBeJqciQORspf5oclh7/bYdMyRomBW/vTzIzuUsCGK2HfF/63V+y+kX1wHZpx0dvfyzZo9diu7c+5anTjdpVzpUubCHC+fzk= 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=lY3a4uzf; 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 :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=5CaGINr/VQqkg0HtDZ9KeFK/+9trW1V6dMyw4Bgc270=; b=lY3a4u zfld32wfH4WUL8Fm84yFopCDkgAwUrowvJJrQNd5QaqfufIDme8DSb1wMhKQcBtb KzzyDsm3FGV/G74PQox/1wqS8Hzl74zYDADALvgzSC5cFjos/By4eJu5b5sW90i/ vlxQmRI986OUKIjZelr6xYkJY97E+lFH8nClZRlHCgkZvacWvRBkZp3ZTR2uQE+t LAgq89wrnzqT7Z4M301GBI4QHVEQN8nkructC2lMlwcdmKVpelFjlLqvZASfau9K 5jkn0EsKI8jcPEiqvRSaPGPqwqORgEmZ1bSyPGggq79AGk0tknqdxFu1xM7YBujx 3ud/TAFNGhfIRi8g== Received: (qmail 1781809 invoked from network); 27 Apr 2024 22:36:14 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:14 +0200 X-UD-Smtp-Session: l3s3148p1@YMW1+BkXtI9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Elie Morisse , Shyam Sundar S K , Andi Shyti , linux-kernel@vger.kernel.org Subject: [PATCH 01/15] i2c: amd-mp2-plat: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:53 +0200 Message-ID: <20240427203611.3750-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240427203611.3750-1-wsa+renesas@sang-engineering.com> References: <20240427203611.3750-1-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-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/i2c/busses/i2c-amd-mp2-plat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-amd-mp2-plat.c b/drivers/i2c/busses/i2c-amd-mp2-plat.c index 112fe2bc5662..d3ac1c77a509 100644 --- a/drivers/i2c/busses/i2c-amd-mp2-plat.c +++ b/drivers/i2c/busses/i2c-amd-mp2-plat.c @@ -97,17 +97,17 @@ static void i2c_amd_cmd_completion(struct amd_i2c_common *i2c_common) static int i2c_amd_check_cmd_completion(struct amd_i2c_dev *i2c_dev) { struct amd_i2c_common *i2c_common = &i2c_dev->common; - unsigned long timeout; + unsigned long time_left; - timeout = wait_for_completion_timeout(&i2c_dev->cmd_complete, - i2c_dev->adap.timeout); + time_left = wait_for_completion_timeout(&i2c_dev->cmd_complete, + i2c_dev->adap.timeout); if ((i2c_common->reqcmd == i2c_read || i2c_common->reqcmd == i2c_write) && i2c_common->msg->len > 32) i2c_amd_dma_unmap(i2c_common); - if (timeout == 0) { + if (time_left == 0) { amd_mp2_rw_timeout(i2c_common); return -ETIMEDOUT; } -- 2.43.0