Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1849885lqg; Mon, 4 Mar 2024 05:58:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX9H4BfTW+0i7KdxaB4cg1nQrqRhv2lW5lPrOg4XbSh1v7NcvdcG3xcVYDqpAt2KwxmXuA5qX67ecF55i6dGOwSd+rS5olp5eBvi1Va4Q== X-Google-Smtp-Source: AGHT+IH0fEARO8cUwtwDDMlD2LhJihm9hRdWwbT7JY8Ns66ObvGD4N9OdIIQQRtTus+wkgbWXNLG X-Received: by 2002:a54:460c:0:b0:3c1:d9b1:3c57 with SMTP id p12-20020a54460c000000b003c1d9b13c57mr6191136oip.10.1709560711530; Mon, 04 Mar 2024 05:58:31 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o2-20020a63e342000000b005e42b4c97a1si8364566pgj.312.2024.03.04.05.58.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 05:58:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90687-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=naGONxvi; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-90687-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90687-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 A86E1282C84 for ; Mon, 4 Mar 2024 13:54:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A6793F8E4; Mon, 4 Mar 2024 13:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="naGONxvi" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7335C2EB0F; Mon, 4 Mar 2024 13:54:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709560473; cv=none; b=UDMVhjIICKihWxElnHsHP47R7+NC2b/tUBqX3EXRn3q7c4Zov2djNG4gQXo0Z2rx7q96NfR4+GFpHQWSKrgpzPPP7lBiBa+24R8UQtVEDCa9+IiNozHIRblJid97ppjjk4Pch77Igm9zqCnzv6ftGzc6iIJzJUorig8CrETwOmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709560473; c=relaxed/simple; bh=mWRjn7hvcn6TDv6eSOXSuLbqd/PVmvXDiSISYrczEcc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t/VxSqsW67w5rpNz6U52qHwDhdYm+BUfU6bK5G6UPvt4TDCbzyk9UNGdGK6bAaaP4hNFVyPjt2hvRoxE9i3u9s3cj3X4qbnRZFym2AS3F5vaXPl9u/YGBjRvzbnVueeCJ5G3JLD9e8ug5zmm2MOdOdVrPPrysEJQHtA3l4GA+rk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=naGONxvi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BDBEC433C7; Mon, 4 Mar 2024 13:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709560473; bh=mWRjn7hvcn6TDv6eSOXSuLbqd/PVmvXDiSISYrczEcc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=naGONxvixu1JN3g9GxpNn1Nnh3iTkNTzYFs9D1EkMV0hrEejQT5nG3J+uIOIOdd+i BTKQv3zQAswJJIHDHASL8ufiBaSVJcswdSrouOkjFurPtUmpnWQaWL2LjfvCSv7BuV 1om5rZBGVIf4xpqZ+MgSPoU/J4VZw7Y/arvZNRZCXGTbjI+Ir6cF2zM/uosa3Nseac /5AiOjqLOl6wP6gXE/dUvVmPc9pxH0+tAouQpZmWq+G0dECRvi6Hz//5DTUi8PICxX jemN+rnZA8cJLwJ7UwaKTzw663VZ4wpia6oURBKK1YJ6CgGPZ42ovO0A9l6Wy99TDw z7G5GUwkzCKAA== Date: Mon, 4 Mar 2024 14:54:28 +0100 From: Andi Shyti To: =?utf-8?B?VGjDqW8=?= Lebrun Cc: Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , 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 Subject: Re: [SPAM] [PATCH v2 06/11] i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer Message-ID: References: <20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com> <20240229-mbly-i2c-v2-6-b32ed18c098c@bootlin.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240229-mbly-i2c-v2-6-b32ed18c098c@bootlin.com> Hi Theo, .. > +static bool nmk_i2c_wait_xfer_done(struct nmk_i2c_dev *priv) > +{ > + if (priv->timeout_usecs < jiffies_to_usecs(1)) { > + unsigned long timeout_usecs = priv->timeout_usecs; > + ktime_t timeout = ktime_set(0, timeout_usecs * NSEC_PER_USEC); > + > + wait_event_hrtimeout(priv->xfer_wq, priv->xfer_done, timeout); > + } else { > + unsigned long timeout = usecs_to_jiffies(priv->timeout_usecs); > + > + wait_event_timeout(priv->xfer_wq, priv->xfer_done, timeout); > + } > + > + return priv->xfer_done; You could eventually write this as static bool nmk_i2c_wait_xfer_done(struct nmk_i2c_dev *priv) { if (priv->timeout_usecs < jiffies_to_usecs(1)) { ... return !wait_event_hrtimeout(...); } ... return wait_event_timeout(...); } It looks a bit cleaner to me... your choice. Rest looks good. Reviewed-by: Andi Shyti Andi