From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795899191; b=a6gO9QcV/BXjz0TgewJuPGTehAJIjxToA9AUKU+COqxRCuOqTq4mWXk9/oiiB2h0Wrwo A2bBWGWjsVCgjpCJnFxGEXCdeuLgk3sptFmZSkp6CcDQ4R7WRFiajeZa+BYx3NAfLdkIu bZ341hy+gQvyGCSeHU5f/GmCgqk/Q01xsIUf7lrUDkAwn7nax5uqeBbM7UvXtoT/yZa+e PW8NGcCIT3HVr0tZAUFgni1R28+bsEvLRWeKhPm4f+Qj1KPsoDtYUgThRqdZ3OQMymFam fodlNxuXrzhIHi5aEdWWWKQEV1fjUzbR6pYy+7PYfOuxI2Egg3jg5yoKk/Ps6FOFRbA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795899191; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: In-Reply-To:References:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=JHWunCFh0Qshr5rAdVnc7/5pFj1Yiw51PeIAnEYl7zs=; b=i9IpZy3xcV6RFZZjQcdoW+kxsE8EyCOmfxuPzA8jEcydWlL7zwmCyMBhxFO1fCbQtT9L G8rKolUtTtU79uobwnHChnF5YivC5NzoTMbFAg8SvQ3xtYEVUYSdON3GvKPbxgXOzx6Vm 9xnB+pKB/tTUXtpJ9NiXkFobIqbgSNJWt5cjXpeJrgi8oB+lgVLjW/yqkPeTrCCeIuRcz KOwRF2Cv7zgvP6JpQuawvr+N4zDsVB8IvLTLT4cLTBjz7ZzzmSVUs9r7g4/dJkF8CuFl6 +UwOaIlXXpXUZ498ZU8yyRhd+SQamD3hvbaJL55+LVVnKypXHEtFSj3dtE5sUkajkIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MAtx1H2i; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7D7E606A31C; Sat, 28 Nov 2026 20:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MAtx1H2i Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D82E1F000C1; Sat, 28 Nov 2026 20:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795899190; bh=JHWunCFh0Qshr5rAdVnc7/5pFj1Yiw51PeIAnEYl7zs=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=MAtx1H2ibPo6LnL3fqqO43EzwYZA8UwqMF6Ah43ltkz91vKUqdAU5iYaB0XJPEw7r h91S4npyMlE8N2vGO2SU1atDno+y8CUOsrQr4o19tV/bTgt0wkTGuPrCbxgFTKCzle 6XY3BP+JMrd+Rk32UZtSJGDiIW9lLJTjWgwZvDf+tHIhc4H3x+Z1hUXKFa2K7ycrY8 AAobwZdsf8XQev1W+lM8XX9ra+lNmlA3BRul5DL9FoFD5G5DMxFyqhlGWWwyHsTrCd 1m7sRb2EtH2uwx99LwY/8/QLj70Clc0dxQ1mR/jv15rb9WtR+WvqtNCjcr+tCo0wd7 UjPmAjcsyPtlA== Date: Sat, 28 Nov 2026 20:53:00 +0000 From: Jonathan Cameron To: Andy Shevchenko Cc: Svyatoslav Ryhel , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , Lee Jones , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, mfd@lists.linux.dev Subject: Re: [PATCH v3 3/4] iio: adc: Add support for MAX8907 ADC cell Message-ID: <20261128205300.5361ccb0@jic23-hlaptop> In-Reply-To: References: <20261123150725.212836-1-clamor95@gmail.com> <20261123150725.212836-4-clamor95@gmail.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > ... > > > > > + ret = regmap_read_poll_timeout(regmap, MAX8907_REG_TSC_STA_INT, value, > > > > + !(value & MAX8907_MASK_NREF_OK), 10, 1000); > > > > > > ret = regmap_read_poll_timeout(map, MAX8907_REG_TSC_STA_INT, value, > > > !(value & MAX8907_MASK_NREF_OK), > > > 10, 1 * USEC_PER_MSEC); > > > > > > > hmm, replace 1000 (4 chars, pretty readable) with USEC_PER_MSEC (12 > > chars and twice wrapped line and needs tinkering or looking into > > units.h), I don't think so. > > Because the point is missed? We have tons of much longer multipliers that kill > two birds with one stone: > - avoiding possible typos when many 0:s are in them (one can be missed or too many) > - hinting reader of the units of the used values without even looking into the docs > - (and reading 1...MSEC is quite natural, without counting 0:s and thinking how > many of them and what 1000 microseconds, after spending time on the > documentation, means in practice) > > Please, use multipliers where it's makes code better to understand for > unprepared reader. > > ... > > > I would like to hear what Jonathan has to say. > > OK. So a mixed reply. In majority of cases I'd agree with Andy that the documentation value would make it a good idea, but let us look at the code in question. ret = regmap_read_poll_timeout(map, MAX8907_REG_TSC_STA_INT, value, !(value & MAX8907_MASK_NREF_OK), 10, 1 * USEC_PER_MSEC); So the reason I don't like it here is that 10 and the result that we represent them in different ways. So I do slightly prefer the 1000 here as then we can see immediately that we have a reasonable ratio of poll to timeout. These are subtle so there is often no perfect answer particularly when like this we have timeout and timing related functions with no great consistency on timebase. It could be made explicit. timeout_usecs = 1 * USEC_PER_MSEC; ret = regmap_read_poll_timeout(map, MAX8907_REG_TSC_STA_INT, value, !(value & MAX8907_MASK_NREF_OK), timeout_usecs / 100, timeout_usecs); Which I think is the clearest of all options for this - but at cost of a local variable - hence not perfect either! Jonathan