Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2593603pxb; Thu, 11 Feb 2021 17:16:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEkwMqLfkaasayB//S1Yc56GHvYQLidj6erDY6LX6wNbhG3TMWaW7XvOGFC3f0+ciNYnsu X-Received: by 2002:a17:906:7689:: with SMTP id o9mr525594ejm.324.1613092564444; Thu, 11 Feb 2021 17:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613092564; cv=none; d=google.com; s=arc-20160816; b=ULwjMn7JcT0qSHrfkycAzzTiOqKdZ3tYCeT4yw9UZTE/EScVSD2EJg69BQz0C4vSkv QNV5mekcjts5cqeS9wnydfJurl3+RAksj3YrV+b+2VgsbjeoOMzVC4XDvVfIaY+boOUm ki5l+seNWPSxdNEpsl0tiabUUAX+j2iztO1L8mITllWy9OGm2ee3pw4m7v7a15XMtxWx /Eneo/xBjBj7e85YGaNsP9+wgM2A+jDBAg0SiN7ztiPtDEiQM5q2pRVpvPA8BzceqgCA XbHyDj+XnR9jdqFVkewgqxisDB+ayZDA6B40E6ukqfYOdkRESJm7T9kFjGsH1pu0aOF4 sGfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=F8f7LywDtKTmk9rZYp4IQgbKog4kMRZJjOcgsQe3LqI=; b=MX4eukCpMLziP2OJZHCgqQMZVpwiJHjTskZcS/5BnKDlP6YENZBdfhofY/RhuurQaC 0kh0Qt8d3uEXRyp2MT8QQxuV5aBGK/+ZS8hzxUmAYE3M3Vf3Lfwc6juhvmLrDx966ZZ2 F0m/mmW9o9EDMfn8R2CY4nia4efbz0P9A7abz07cbTat3/rlhaYEQFMyc8fqtFJ57gue zkrm6FeCCB+0nc86v4e5M4zF0jqjN8qNu7OylNR/lhj58SymiEa8QYY7ZwaF8AWqUPrj ccMrfe/rBAlIk4/Wd/9T5yUjeu5xZvZz9vSYvWP/0D/04rgv8N0zmvLvnB2oEjQJz4V6 Zbwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=xxBJvN3o; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w27si4818443ejk.211.2021.02.11.17.15.40; Thu, 11 Feb 2021 17:16:04 -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; dkim=fail header.i=@lechnology.com header.s=default header.b=xxBJvN3o; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbhBLBNC (ORCPT + 99 others); Thu, 11 Feb 2021 20:13:02 -0500 Received: from vern.gendns.com ([98.142.107.122]:47300 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbhBLBL5 (ORCPT ); Thu, 11 Feb 2021 20:11:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=F8f7LywDtKTmk9rZYp4IQgbKog4kMRZJjOcgsQe3LqI=; b=xxBJvN3oq/mEpgslNCzqZoWktf YJ0QYkvdGpElUtgNgkwXtP7+tEsxB0biJ3ZWbgHicnsF846uU6fcXixCtGd3jIUUfD8CC6IY3Y96P 6qWX9qXc9CXI85/JI2r+zF6nrgIbdGBM9eixwoYPbXOTUf5rW0DSSjK9D8MYzlcgG1cPcNQwXiZxO XHFez9U8PNdsv6grLAIl+atBuO5RLoPCMCJw4SOxF87+kYMQYPRLUVFe7uKOT6TUvt5UV9CYK6oFu 8dbpxcLq21lmZuz9YkBzZKRpACK89nYiYAxr+s/UEA+10lLrr9KvzCtzmh79lTKaqaw0Kc+M3FQoE kWs9fGLA==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:43618 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lAMz7-0001We-0Y; Thu, 11 Feb 2021 20:11:01 -0500 Subject: Re: [PATCH v7 5/5] counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8 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, 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 References: <7a78ad95-9eba-277d-25da-ddf68357b969@lechnology.com> From: David Lechner Message-ID: Date: Thu, 11 Feb 2021 19:10:59 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/11/21 5:56 PM, William Breathitt Gray wrote: > On Wed, Dec 30, 2020 at 11:36:45AM -0600, David Lechner wrote: >> On 12/25/20 6:15 PM, William Breathitt Gray wrote: >> >>> diff --git a/Documentation/ABI/testing/sysfs-bus-counter-104-quad-8 b/Documentation/ABI/testing/sysfs-bus-counter-104-quad-8 >>> index eac32180c40d..0ecba24d43aa 100644 >>> --- a/Documentation/ABI/testing/sysfs-bus-counter-104-quad-8 >>> +++ b/Documentation/ABI/testing/sysfs-bus-counter-104-quad-8 >>> @@ -1,3 +1,28 @@ >>> +What: /sys/bus/counter/devices/counterX/countY/irq_trigger >> >> Do we really need this sysfs attribute? Shouldn't interrupts be configured >> _only_ by the chrdev interface? > > I think this attribute can go away because we can implicitly figure out > the correct IRQ configuration from the struct counter_watch data when a > user executes a COUNTER_ADD_WATCH_IOCTL ioctl command. > > However, I need some help deciding on an appropriate behavior for > conflicting counter_watch configurations. Let me give some context > first. > > The 104-QUAD-8 features 8 channels (essentially 8 independent physical > counters on the device). Each channel can independently issue an event, > but any particular channel can only be set to a single kind of event > (COUNTER_EVENT_INDEX, COUNTER_EVENT_OVERFLOW, etc.). > > The purpose of the irq_trigger sysfs attribute I introduced in this > patch is to allow the user to select the event configuration they want > for a particular channel. We can theoretically figure this out > implicitly from the struct counter_watch request, so this sysfs > attribute may not be necessary. > > However, how do we handle the case where a user executes two > COUNTER_ADD_WATCH_IOCTL ioctl commands for the same channel but with > different event selections? I'm considering three possible behaviors: > > * Fail the second ioctl call; event selection of the first struct > counter_watch takes precedence and thus second is incompatible. > * Issue a dev_warn() indicating that the second struct counter_watch > event selection will now be the event configuration for that channel. > * Don't notify the user, just silently reconfigure for the second struct > counter_watch event selection. > > I'm suspecting the first behavior I listed here (ioctl returning failed) > is the most appropriate as a user is explicitly made known of this > particular device's inability to support more than one type of event per > channel. > > What do you think? > I agree that it should return an error instead of adding the watch. I'm pretty sure that is how I implemented the TI eQEP driver already.