Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp947337pxb; Sun, 21 Feb 2021 06:05:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2zZmfwMIXm13STrnVOQLXnMPI23HHaSDkbYIFQi3++8g58erfBG8roqT+PYVaMG69wTtQ X-Received: by 2002:aa7:c243:: with SMTP id y3mr6092710edo.122.1613916305409; Sun, 21 Feb 2021 06:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613916305; cv=none; d=google.com; s=arc-20160816; b=eSdedXLxThwsjsQnp5sngdqNaP9yxklA7YBjbctUHB1M0XYWGNiMiruEXo619Dqvhq xlUI2bF+K2vpgV6x4hdHATtth+MFdXhwUvpRzFJGJuuMM8P9JVB+BIpt0ICwK68kNHVJ bziOXylL6BjLaDkieLE9MpDoSUEmDagtOCsDYGklym9UeLWhBKJPXftIvjE3LqNSKpJa N3Zokp2dPN3dt/vj4+YxZ5pilhJmfXNVK2iQlSuWxtoB2xbGeGAKA3faOpMHb1BOCCm8 auk8snaNsgcrFUpBTqk5qhcUVc9w8g4GnZWMzuILFJ9swV7dAIHpjTw984xpgdfm0EIO lp3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=hmKpaHJwUslCsLfPt9+DGm9JABxIKQTuPBHSXCTEa9I=; b=dfce6nAHXcRUyqF4mTNhSOgLh+YNfhUSHDMTyMPWc4nu84fNqZoeM94TormYDOyLIk h3/yv1omuW+G0JIOXCy7z0x0x6EHvS4xV4igVWBl0thhLJg6EYPxqMr1oJ6rRCwsIXht tqRTnyfmA0fCJbOnYtw3eqvCY6ju+q7TS1CMryOqHXXeQo89qaqWaqzyAKHih7qMhCep /fF+qtp2Oa+Nc0lUIzXi01QYzjoG24mRPBCi5NRe361WAxRhgvW2YkBzUysADVpkjOFN IWdQUxGhRm9fYo9MAbnCElByL5TfQ9CWaw+B/kWz+nfzjVc5zp4kvKKYmh9+trov0DCe a25g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j9si5599221ejn.497.2021.02.21.06.04.41; Sun, 21 Feb 2021 06:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbhBUOD7 (ORCPT + 99 others); Sun, 21 Feb 2021 09:03:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:52736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbhBUOD7 (ORCPT ); Sun, 21 Feb 2021 09:03:59 -0500 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E86E64EE0; Sun, 21 Feb 2021 14:03:15 +0000 (UTC) Date: Sun, 21 Feb 2021 14:03:12 +0000 From: Jonathan Cameron To: William Breathitt Gray Cc: kernel@pengutronix.de, linux-stm32@st-md-mailman.stormreply.com, a.fatoum@pengutronix.de, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, david@lechnology.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, o.rempel@pengutronix.de Subject: Re: [PATCH v8 10/22] counter: Standardize to ERANGE for limit exceeded errors Message-ID: <20210221140312.299b0e5a@archlinux> In-Reply-To: References: <7fa80c10fcd10d1d47d1bddced2b2cca3ff59ba9.1613131238.git.vilhelm.gray@gmail.com> <20210214171021.41b3e4e3@archlinux> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Feb 2021 10:26:52 +0900 William Breathitt Gray wrote: > On Sun, Feb 14, 2021 at 05:10:21PM +0000, Jonathan Cameron wrote: > > On Fri, 12 Feb 2021 21:13:34 +0900 > > William Breathitt Gray wrote: > > > > > ERANGE is a semantically better error code to return when an argument > > > value falls outside the supported limit range of a device. > > > > #define ERANGE 34 /* Math result not representable */ > > > > Not generally applicable to a parameter being out of range > > despite the name. > > #define EINVAL 22 /* Invalid argument */ > > Is probably closer to what we want to describe here. > > > > Jonathan > > The comment for ERANGE in error-base.h may be terse to a fault. I > believe there's a connotation here provided by ERANGE that is absent > from EINVAL: primarily that the device buffer is incapable of supporting > the desired value (i.e. there is a hardware limitation). > > This is why strtoul() returns ERANGE if the correct value is outside the > range of representable values: the result of the operation is valid in > theory (it would be an unsigned integer), but it cannot be returned to > the user due to a limitation of the hardware to support that value (e.g. > 32-bit registers) [1]. > > The changes in this patch follow the same logic: these are arguments > that are valid in theory (e.g. they are unsigned integers), but the > underlying devices are incapable of processing such a value (e.g. the > 104-QUAD-8 can only handle 24-bit values). > > [1] https://stackoverflow.com/a/34981398/1806289 Its a bit of a stretch, but I can't claim to feel that strongly about this. Jonathan > > William Breathitt Gray