From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A0FBC433B4 for ; Thu, 15 Apr 2021 15:22:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A08561152 for ; Thu, 15 Apr 2021 15:22:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A08561152 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0Y2vN4rc3iNtKNh6gomANteSuXw2iEwJg8+rKF/I7cE=; b=UWsOhlhuECpmvHeZhiSCRiepr m6wPk4U+MxAkUYNRo9UObT9gC5KYOF3Jd9xWFUJGN4xoz/Cc5FZOGOhLrmxxnqHEitJ74u4xuLDym BoUSB3mnH92YfXbXixuIriyX+AOnVCAsUp4SOwCV62ynVK2tsFDl2KnU+oXInW29fEeGtjk7qB22Q BFIBcX+4sSRVxKKpIEptC7uZp9+/0EexCj7ZxXK7B3dvbK3eYtjoeAEeUASwRqBdGXgONK30CBJdV rPxj2Fl21Kg4beG+08MIPZFS2qCSoNU5nDcaQqidL1ijY+bzUeZo+QqR2x30zKEWbQ3exUyyj7vy4 gYSKtmPRA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lX3nW-00GaP1-Dm; Thu, 15 Apr 2021 15:20:50 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lX3nS-00GaOX-7U for linux-arm-kernel@desiato.infradead.org; Thu, 15 Apr 2021 15:20:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=umBbGUAcWrcnGAbWhTZRypZWZRPTnQBY0Pg5VVxN0NU=; b=QvrPerpWDithqsGWAo/1xusycU tB8Ovk4ZQs72uKvy7+9zy8sEwbhBjR5B5Oet7tB4D7G5TtCQMnozqIpCBvl5pP6rfruCxkTjss4sz 2LekM3kTq2AA/ECJllXQz1pPdAgKl4RbPzSWDNxOg+lyB9VuTjbbn717PadoqTvOpIZGviMVWZXur 6jHBOcwCk8bRGZ1/KM51HS6XLn1I+OHXHE6bqz9YK68E7CVwv5l/95SaZk5hYrJ2is3K40ekghufe aXn3ouF1PhY4pc48V81/NMp1FUieY6y5AfpQz5Nh92Yx7K/hOVuNQLrtaAkBCIpqkJ+vowqwMgkKo GryLI5EA==; Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lX3nP-008haA-Jr for linux-arm-kernel@lists.infradead.org; Thu, 15 Apr 2021 15:20:44 +0000 Received: by mail-pg1-x529.google.com with SMTP id z16so17121759pga.1 for ; Thu, 15 Apr 2021 08:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=umBbGUAcWrcnGAbWhTZRypZWZRPTnQBY0Pg5VVxN0NU=; b=j8JtVZdEfZvjgzlCRUWZnsT1XYSTKwNnzx1AlxBNWsV8wqVQ5yI1ITZpnTTZ7/M1Kf eLz5FWg9Khr1aCNThpw+mY1bpbzOtZkBSV9AxA5SONuE3rypEyv/PIU0dDQFJ04gGx3Y E974ZCEwm8UO31jg4AcdmN5qqRUvLnmVKpFWoWt73SEd1tFwu0tnXo5SUJ8ci7kdI4mE E53O53QfxrAr2liXsQyMVaiE5dgdazQBl68VtFH6Hmb4AeZaqKrbLzldrTPb7x5Of9cQ WHZIRusdNipMmKT0+yuyShdZ2bCs7uXepluojpVfHWspQSHydk5SgG6xerqcibc8H4YO bu3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=umBbGUAcWrcnGAbWhTZRypZWZRPTnQBY0Pg5VVxN0NU=; b=BooBawNM/bFNqG+tEoBz9gu1nlZoj80X5y87+5UODTQJMTP31sU8mTrRV4AQmDpHZY XrfL94GaDAwpeTiRHbFwkjRp74NWGGlm8WbLx5B77MFppxjCZKhzlQuNDUOfYKNlIjPS l8+ZdZ0dUqgSx2kUObTNJtvtKf6HVpqZznsv/AwFl21X5iQdj53G6mn/+Buu4AR7HPJL G/oA2Zs+VJu6X0k94d5UDd7Y+nHXJxzcQiZTZiJBkE4Cud4M7wW+3rQBGZ++97yTpJ9L wNXzbQB3kbEQlxAvxLG78ZRoDmFff4u1rAhAioqyRYLy3nXmDB9R8oIWFhGF+wku+gTg gSjw== X-Gm-Message-State: AOAM531HD+D1vAszS3InksxqrVWmITDAGu5tzSdyjZ+pv+IDNhNGum6V 8exVUeX9GiLbgixW9ynIUoI= X-Google-Smtp-Source: ABdhPJwisj47l96nQA7bO6SGjtpW+hDMip4ZpK4dUx7XiRiSdphPBbq+tom71ZA18rPGQtyWtvtp+Q== X-Received: by 2002:a63:9dc5:: with SMTP id i188mr3962509pgd.191.1618500042545; Thu, 15 Apr 2021 08:20:42 -0700 (PDT) Received: from syed ([2401:4900:2eec:4193:f802:b600:e94c:55c4]) by smtp.gmail.com with ESMTPSA id r1sm2905036pjo.26.2021.04.15.08.20.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Apr 2021 08:20:42 -0700 (PDT) Date: Thu, 15 Apr 2021 20:50:31 +0530 From: Syed Nayyar Waris To: William Breathitt Gray Cc: jic23@kernel.org, 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, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, o.rempel@pengutronix.de Subject: Re: [PATCH v10 19/33] counter: Standardize to ERANGE for limit exceeded errors Message-ID: <20210415152031.GH8933@syed> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210415_082043_675231_E33E5D2B X-CRM114-Status: GOOD ( 19.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Mar 19, 2021 at 08:00:38PM +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. > > Cc: Syed Nayyar Waris > Cc: Oleksij Rempel > Cc: Fabrice Gasnier > Cc: Maxime Coquelin > Cc: Alexandre Torgue > Reviewed-by: David Lechner > Signed-off-by: William Breathitt Gray > --- > drivers/counter/104-quad-8.c | 6 +++--- For the 104-quad-8 driver: Acked-by: Syed Nayyar Waris > drivers/counter/interrupt-cnt.c | 3 +++ > drivers/counter/stm32-lptimer-cnt.c | 2 +- > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c > index b7d6c1c43655..0409b1771fd9 100644 > --- a/drivers/counter/104-quad-8.c > +++ b/drivers/counter/104-quad-8.c > @@ -154,7 +154,7 @@ static int quad8_count_write(struct counter_device *counter, > > /* Only 24-bit values are supported */ > if (val > 0xFFFFFF) > - return -EINVAL; > + return -ERANGE; > > mutex_lock(&priv->lock); > > @@ -669,7 +669,7 @@ static ssize_t quad8_count_preset_write(struct counter_device *counter, > > /* Only 24-bit values are supported */ > if (preset > 0xFFFFFF) > - return -EINVAL; > + return -ERANGE; > > mutex_lock(&priv->lock); > > @@ -714,7 +714,7 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, > > /* Only 24-bit values are supported */ > if (ceiling > 0xFFFFFF) > - return -EINVAL; > + return -ERANGE; > > mutex_lock(&priv->lock); > > diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c > index 0e07607f2cd3..f27dea317965 100644 > --- a/drivers/counter/interrupt-cnt.c > +++ b/drivers/counter/interrupt-cnt.c > @@ -107,6 +107,9 @@ static int interrupt_cnt_write(struct counter_device *counter, > { > struct interrupt_cnt_priv *priv = counter->priv; > > + if (val != (typeof(priv->count.counter))val) > + return -ERANGE; > + > atomic_set(&priv->count, val); > > return 0; > diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c > index 78f383b77bd2..49aeb9e393f3 100644 > --- a/drivers/counter/stm32-lptimer-cnt.c > +++ b/drivers/counter/stm32-lptimer-cnt.c > @@ -283,7 +283,7 @@ static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter, > return ret; > > if (ceiling > STM32_LPTIM_MAX_ARR) > - return -EINVAL; > + return -ERANGE; > > priv->ceiling = ceiling; > > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel