Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp60838lqi; Wed, 6 Mar 2024 10:02:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUrJaKu4JqAk8AK8fLPd6BL8jgXWgLLm1b7R2srbmNtYvlHCbK0XitmZRW7Yv6+AWgN61enqsTNQseMsHES5E3MG4GOekcuB2JPDIRBdw== X-Google-Smtp-Source: AGHT+IFWThzWbOEbqsHYrsMcogXi+Gqjk5PmntW0v3DwESEHD4UtaEvR2b5cAx/nRc0bpmgmaGWT X-Received: by 2002:a0c:e911:0:b0:690:5b78:5c10 with SMTP id a17-20020a0ce911000000b006905b785c10mr5932783qvo.26.1709748153857; Wed, 06 Mar 2024 10:02:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709748153; cv=pass; d=google.com; s=arc-20160816; b=A8K2r0Uwx9K8mtcdCtMDLX3WDoPMnq6Vj62JKKJ6oxVxtT7CXAiG7QufPNNwz2NHlp QT/tPxe+cKo54wclZUHJdXxBAvqqzIDoK5KuEEAcZLLPiglxmeoXU18GHWKX1vpX3XIL bunE/FeNPGKlEK4nG2AfrOmUu9mlm4ikFEo6OPXYHBcOdZ7l4nfAuja1b2GralUM/iJi VLR0sb0D4mnZtZtGuRUvwvndkj0v3aaMlB8Oroam+upY1HSga3n1FCMz+B8Xg5MoDIaT /7EIY/arrxw1csT8ZPZwWzsDhc9TLRmgwQ9gjfWLMKtUMLpnFQA/rUGFQGvhoIVbC9uq JfHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=QRiNeZgV6eBZpUWar1JZGPdnG7GRdzz01xQrVaFgykE=; fh=uCG8wfa5a09oU3n63rBU2pdvyHLoFuy1Id9IodSg564=; b=plur39kJOtdc2nWpmDF9ahlj/LIBtj2nSSnlX5whOtyfjKtSF1ictH7KXD+sNdInS7 cGBiyS+SLHLzZfl5WSf/eJ30plqxN3QCboQ36rCRfB0imvcf6wkK4KU+yUlJXGML2BEB TXZpCejmC1Pqr2vH9vkB3ICauK1O8FbrZyNUtTSO4+gsOalcFbN0LDGgsuepUOIMDyKD ISRVzkoGaqsYFxpG7OYZU3SCfSxPnovjvPWZsdcQ/b1SYGamyNPmFcRK6gH2wl22Cahk pGY1EbkaytX84KQZtT8ofLgbr1v4jhhYB469yR6asEE7Cf5TOM3ophHxcecddLXiSl5S tQeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Ji3OMBF9; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-94366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id iu4-20020ad45cc4000000b0068f7071cd09si14730263qvb.100.2024.03.06.10.02.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 10:02:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Ji3OMBF9; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-94366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 926101C237AD for ; Wed, 6 Mar 2024 18:01:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B481E142658; Wed, 6 Mar 2024 17:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Ji3OMBF9" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (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 54FF313E7CD; Wed, 6 Mar 2024 17:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747977; cv=none; b=dhTK4/BisGF2urY8vWidV15U4dQoEXUfJ2dy3nMvkBS6d0rf6kwxsSObSriaufQD4iCP7PYM1eFgie+CvMUl2AU/KFWkC4Prxroqs0rKeBT+w/vVbe8Q2dlBsHwSPIZ3dqWlKo8oJN/aiE7L9YadlwbOabde8lmp1IpOalbzLBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747977; c=relaxed/simple; bh=/e84P/owXhlh++tw7rvGRQ64kKz8dN+PoJFWEp8EyIE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=InQgbsAsm7opm+H+1mgpGA+MkbEFmy5eNb7PYjdq3cbA6YDYJZdOkotysXYpTECoyGrMRRjWQFQ3tW6y5rnoGc4tVcJ9EhNfO9DZ7PdlBLxiGZe37NpORUx4ME7B+4WwWI5UipVrZ7fTESsEUOQ3BN9gTn/A9srsVxO0mtVCyqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Ji3OMBF9; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id CC2C040004; Wed, 6 Mar 2024 17:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709747967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QRiNeZgV6eBZpUWar1JZGPdnG7GRdzz01xQrVaFgykE=; b=Ji3OMBF9sh5AUUIrSf+SHwWCBVQbHN2yjqFDrGf6bsfe4EZlx1MqJwUDbZDoEoXUvMVcrs O4RXeBdjOeBcahOsp+5dYJo97Wqpk3SPjmJFwICXVdZf/vPETQHe7Ah8LD+ztGN7lc8aIt 5eVmemBd8Je7K4rKPG85K5oBjf0MlcLmxvNbX3FYTP1bvqEKsDZS6DC6KbTcTWdUk4UY3H +IAbuJuf8UZcEc4IkpXEzcyZIhP0PRf7c/Ex8O64/fSXv1qkziKtmBVk5VkCP90fX5K9B9 Hrugjol1r02k+29Emtr9BnQluYeemmvX2hIACSB3eLHogye9H5/I210WTsB6jQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 06 Mar 2024 18:59:26 +0100 Subject: [PATCH v3 06/11] i2c: nomadik: replace jiffies by ktime for FIFO flushing timeout 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="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240306-mbly-i2c-v3-6-605f866aa4ec@bootlin.com> References: <20240306-mbly-i2c-v3-0-605f866aa4ec@bootlin.com> In-Reply-To: <20240306-mbly-i2c-v3-0-605f866aa4ec@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Gregory Clement , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= , Wolfram Sang X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com The FIFO flush function uses a jiffies amount to detect timeouts as the flushing is async. Replace with ktime to get more accurate precision and support short timeouts. Reviewed-by: Linus Walleij Reviewed-by: Wolfram Sang Reviewed-by: Andi Shyti Signed-off-by: Théo Lebrun --- drivers/i2c/busses/i2c-nomadik.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 2ba7d082e205..020beb8ffa17 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -225,8 +225,8 @@ static inline void i2c_clr_bit(void __iomem *reg, u32 mask) static int flush_i2c_fifo(struct nmk_i2c_dev *priv) { #define LOOP_ATTEMPTS 10 + ktime_t timeout; int i; - unsigned long timeout; /* * flush the transmit and receive FIFO. The flushing @@ -238,9 +238,9 @@ static int flush_i2c_fifo(struct nmk_i2c_dev *priv) writel((I2C_CR_FTX | I2C_CR_FRX), priv->virtbase + I2C_CR); for (i = 0; i < LOOP_ATTEMPTS; i++) { - timeout = jiffies + priv->adap.timeout; + timeout = ktime_add_us(ktime_get(), priv->timeout_usecs); - while (!time_after(jiffies, timeout)) { + while (ktime_after(timeout, ktime_get())) { if ((readl(priv->virtbase + I2C_CR) & (I2C_CR_FTX | I2C_CR_FRX)) == 0) return 0; -- 2.44.0