Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp556592lqa; Sat, 27 Apr 2024 13:36:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+1WspMW8cAzpRzMnQMbAhd5N1HvDrCCEAgImMtNrkIwwZezr4Xrilvu1jSGF//H4uxvlAc0yy8mEqbBeUvrkMFJ3UDV29tzq/uKEs/g== X-Google-Smtp-Source: AGHT+IHh4kTsypx7UvTUD9UYskbAAruf2CFiFIciV83FtMSEcgfRMsRhFjHotjpd8Yxyy9VuLqYv X-Received: by 2002:a05:6a21:788d:b0:1a9:c4ca:dc74 with SMTP id bf13-20020a056a21788d00b001a9c4cadc74mr8203676pzc.5.1714250194955; Sat, 27 Apr 2024 13:36:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714250194; cv=pass; d=google.com; s=arc-20160816; b=sF0sbIjwd7etFrfRzy4bJ5G1vrrRfzUZvjRc96MqBv0RCto1HiwhzPnCrnSOCoU25g ZbegpFSNlIDZ/aHsL6T821GyQho/qiX0PaXdr65Gjqr2Hc3eptOY8Ua0emg5G7AwjcjX Wx9RTsZhzpGWJWJg7vDNPijFs14PJ25mFsLvb/zMZInXQJhFCtyl7tNkoGqMEuShBmQu +CA92yfsITaUIGrNP5iOqZq4l5KhEkQQJXc7RzgG9dZ2Brl7pN/jXYHRS1jqW3VIWHqH lM/xPLMiypp+QQSdC/BehrOhf9+XYeZ12l5pCr13ZS/tLtI/kKSCr6puhignDoHHHOmR O8Yw== 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=ZLv8hXeiJlISzozbBZSXzJgescsNzyHh+xzwSX3kxuA=; fh=hFUVuHYAN8t+S7YjlN7KZQHFyX9S1lxoegHX+1al81s=; b=Avc2k1WaHtnRAnFsb1MipMZYbNhLCYUp0jQ4iyi8/1sMTTRbWOqZjeqDi1cgPo8lwt BR6tUvaFrVJJl9gUH1JHwwHv+zvFpGCUXvJGtrZMYkPPaNgJNRq2nPcKcDqqoRQKLjK5 PS6UTFT3h2IxriPo+eGlkzU8xA4Mk1mgP7+612dyR7hGIhPRw2ipYCNflEo99VTzOHC/ 6370PuUiznPH0gvsoBVv7J3PhrQ18POxzXDD4SFaUJpiIJ9aSQMNbEj83u9M219Ic2ks vPYTIfpGRTg/kZnz07r8Rxx2iUhsw6pZ//Oeiw0lFeyJT/1vZv+LtAfFIPW286Lfl92a vBWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=jefq8255; 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-161167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161167-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ey10-20020a056a0038ca00b006eaada456b9si17165673pfb.214.2024.04.27.13.36.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 13:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=jefq8255; 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-161167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161167-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 99E10281861 for ; Sat, 27 Apr 2024 20:36:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A5DF145B07; 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="jefq8255" 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 8578E144D2F for ; Sat, 27 Apr 2024 20:36:17 +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=1714250180; cv=none; b=cOtoY/uxyyT7rJ1h59xkFB0a8OAEm2xTaFo/VXfYaaTQaGWQzz5NnGeFFzULJYsAMFepigeX58/+k+RklaFe0iUs5GloDsiVpCDfNkVD8vxOmKJrSm3LgVYzlTARgIV+psRZ1PvshuaRPZQhiTYYkjzVb2ujzVIHHrQs2j587tQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714250180; c=relaxed/simple; bh=h1YZllPsTaiaLlHfe955GjP37jjK7/WEfEpoM+4afYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aJ9htb0US0aSGfC+aN1gtRswhDQRrcuniHnn5sjT53Fqa1o8+BIoUpxA6hsvpJGu3A2K8QnFzp32qq19W7nCwZVx9ZqNd5IIOxiSwouO/4uhzX+ybYbxzpczhgl+PIzwi2c3eQ7An+klrTz1FcIX6XMbxqy3W/UFQEq3uPCmDiQ= 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=jefq8255; 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=ZLv8hXeiJlISzozbBZSXzJgescsNzyHh+xzwSX3kxuA=; b=jefq82 55sCtSyVsbvE4qhoIJRG1DsC8Hp+LjOZ9MhXyN/4kndV5BHe2xsXpRwPsggVXrhB lfcl1zRCCW1JxdLc9pIohqFaf8nMK/oSyqbtoXwwl0P3+eYd0Ox/N1BbNlmN1cKa IFfeG1Mi4UKfSM+4FpzqAxW5J1E6yl7MeQpMSwyLofFxDj5UNp++FkGtQgFJtN+x qfn0vMbp7b9dQjsVp7x9HZsNciSFYcaly07YAJyFv4XsdRHHFA5P5d6EZW74AtMw lDtXev+q36Sc7/AokIA5z/QLYTa+0CcUE7xQJcxu2ru6BR2nKbrYXb5h6OcXHF6N lNZGIvO4Rd3u+OVA== Received: (qmail 1781843 invoked from network); 27 Apr 2024 22:36:15 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 27 Apr 2024 22:36:15 +0200 X-UD-Smtp-Session: l3s3148p1@Wh/C+BkXuI9ehh9l From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , Baruch Siach , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/15] i2c: digicolor: use 'time_left' variable with wait_for_completion_timeout() Date: Sat, 27 Apr 2024 22:35:54 +0200 Message-ID: <20240427203611.3750-3-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-digicolor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-digicolor.c index 3462f2bc0fa8..737604ae11fc 100644 --- a/drivers/i2c/busses/i2c-digicolor.c +++ b/drivers/i2c/busses/i2c-digicolor.c @@ -213,7 +213,7 @@ static irqreturn_t dc_i2c_irq(int irq, void *dev_id) static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first, int last) { - unsigned long timeout = msecs_to_jiffies(TIMEOUT_MS); + unsigned long time_left = msecs_to_jiffies(TIMEOUT_MS); unsigned long flags; spin_lock_irqsave(&i2c->lock, flags); @@ -227,9 +227,9 @@ static int dc_i2c_xfer_msg(struct dc_i2c *i2c, struct i2c_msg *msg, int first, dc_i2c_start_msg(i2c, first); spin_unlock_irqrestore(&i2c->lock, flags); - timeout = wait_for_completion_timeout(&i2c->done, timeout); + time_left = wait_for_completion_timeout(&i2c->done, time_left); dc_i2c_set_irq(i2c, 0); - if (timeout == 0) { + if (time_left == 0) { i2c->state = STATE_IDLE; return -ETIMEDOUT; } -- 2.43.0