Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3053109pxj; Sun, 20 Jun 2021 08:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdPuMGbVezs/Vk5ZItE6Qs7nANXRJPaB+P0lfDSy7Pih4M4irzCOM+lAM9AuMFvgpFNkdm X-Received: by 2002:a5d:904c:: with SMTP id v12mr15917348ioq.95.1624203855314; Sun, 20 Jun 2021 08:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624203855; cv=none; d=google.com; s=arc-20160816; b=nDYGv7DSdqix2tLmuiFmVzyDuGJjq5C3/UWqw04fRnAywHPajAwgFj/KATaxXi4x04 zk68hHJUOiI1Gqsq3qqtCfR4R8jXgckUhDDx0+SNTO264snEQ1UF/12xKnWK3r1QSIVM KGVIdL8oBlq5/IIvq2O5lHeKafUN/iQ+FJUVahm3QEfo2nqooKhBmOO9n/mCYBqmw4bK ZDv/DLMA/xD/7C3n9lOMMpIZwh2aEmDEkshOehPzpWbNPEOEmYIlQG2wbIpPMPhi8H9N o85pXhRzs2Js/2GVI7CZT/y5Q0h46+3QGNHizmgexMa9BycVAbztzEZvJ2ivYtEJtv9R w24A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=t9nRTPbnhGrw692xFrKpmDKEFOhh/bXE3l+WNqjS9YY=; b=v1Bm/EXgo+qBeT/BOuUa8y5f43ev/tJqRc6UqCexA0j5VA11T1bl9NOwNkv5dWXYu+ gOT0yq+12OGXjUV04qixAXhW1i+Wp0ltjRCvUBw/++NUM6fjanX0LFoDysxyDiarxDGn wZgqotnSX4jjnF0A/h1GekjGancDmdEvGYK3EKC/k+RdgwTJ7DBs7DX3rznSVihNeuC0 1p8dQ2WuWhp/amWm6VYE6smb/fE6SW3tHzLp3sMxpeYxs7JasIpt+XBq5BOUsvySbvMX Um7FpxgRKuCCArvqIxgF8qDEOWVeoS7CFd1KoFQuMaHOFYIXY0DGvh5JbaqEI1wL5Tus dV7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m7mZ2bkA; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si14651908jal.79.2021.06.20.08.43.51; Sun, 20 Jun 2021 08:44:15 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m7mZ2bkA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbhFTPk3 (ORCPT + 99 others); Sun, 20 Jun 2021 11:40:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbhFTPk2 (ORCPT ); Sun, 20 Jun 2021 11:40:28 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9B81C061574; Sun, 20 Jun 2021 08:38:15 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id w4so11465990ior.1; Sun, 20 Jun 2021 08:38:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t9nRTPbnhGrw692xFrKpmDKEFOhh/bXE3l+WNqjS9YY=; b=m7mZ2bkAl82i0pDvmQsv6CZp2BngHDLDC3Kcnyn7dJhZ/7hBn+Lb8bWHgDVljYqOv4 /xeWCFi0zdwFZRTlq2hO7KQvFZ9ZTS7rIjPbxkitFcDxXIct5m9wAyn/l4PLTqB0i1n5 TLJZOKC7OJVIRiPT4IWkkhOewy7pyTkM7MaLDAXRkT7SDsD68j3//kV3+uCLd+2nOjis 8M2rKYzsxhLFH4FJmAgkGhv+1wZTAMEsONkzbHWFFbrfK87yhhwIntP0k+g5IiH8WFyP +tSwr1d/mTJ8Y2T4sjIp572FICPdNG6C9wg/aahS3LDwCBlsmmSmj88yqKccv2nCiXm9 CpMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t9nRTPbnhGrw692xFrKpmDKEFOhh/bXE3l+WNqjS9YY=; b=SmA5rQB2lH6KOEW62yoEPVpNmrfogb0aUlFy7yEstSNfOqW9km4Pvwm/N6QJcV6eLG 3U8jShvcrNu4MZJsXLI4IgFLGq8B0O9Li94kTdREJ/wmoTo3HdmGKJP9+VJt1hdXXdIU 8OrpG5iup7uZ8KeTrDdVJKi+bfxUw9o448WbiqnPHby1hEBi3c7i5SRQ/4Q6YieWJc31 rYJr2iiyiQZeu5FIQi/EKX6RZ8B2gs5sYjVeda2UZzjMb/HqcU41DZMM93YkSToVI+Yy 98JZYcyJ8zNRu7Cb58yi20VGHQpfcelWEmvjGQatwf/rGO7IxWXKGNwZravB9lddhkcd 021Q== X-Gm-Message-State: AOAM530Mv3yCmu8o45l5ftG5KOkju4ETkRN8+8DnjgD+FWvr6jMkUWaA RyhYWhhIuT228CgVFHrXxozB6B6sMWlamuotdk8= X-Received: by 2002:a02:9f12:: with SMTP id z18mr13326563jal.54.1624203495189; Sun, 20 Jun 2021 08:38:15 -0700 (PDT) MIME-Version: 1.0 References: <20210610012923.146727-1-vilhelm.gray@gmail.com> In-Reply-To: <20210610012923.146727-1-vilhelm.gray@gmail.com> From: Syed Nayyar Waris Date: Sun, 20 Jun 2021 21:08:03 +0530 Message-ID: Subject: Re: [PATCH] counter: 104-quad-8: Return error when invalid mode during ceiling_write To: William Breathitt Gray Cc: Jonathan Cameron , linux-iio@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 10, 2021 at 6:59 AM William Breathitt Gray wrote: > > The 104-QUAD-8 only has two count modes where a ceiling value makes > sense: Range Limit and Modulo-N. Outside of these two modes, setting a > ceiling value is an invalid operation -- so let's report it as such by > returning -EINVAL. > > Fixes: fc069262261c ("counter: 104-quad-8: Add lock guards - generic interface") > Cc: Syed Nayyar Waris > Signed-off-by: William Breathitt Gray > --- > drivers/counter/104-quad-8.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c > index 09a9a77cce06..81f9642777fb 100644 > --- a/drivers/counter/104-quad-8.c > +++ b/drivers/counter/104-quad-8.c > @@ -715,12 +715,13 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, > case 1: > case 3: > quad8_preset_register_set(priv, count->id, ceiling); > - break; > + mutex_unlock(&priv->lock); > + return len; > } > > mutex_unlock(&priv->lock); > > - return len; > + return -EINVAL; > } > > static ssize_t quad8_count_preset_enable_read(struct counter_device *counter, > -- > 2.32.0 > Acked-by: Syed Nayyar Waris Thanks