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=-13.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 80C9FC4338F for ; Tue, 3 Aug 2021 12:11:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 49EF760D07 for ; Tue, 3 Aug 2021 12:11:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 49EF760D07 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=YM2Zlm9t+Q3e4SwSuUQr96pWkiTe6ENxJPrcHN3WwK8=; b=cet3PUJy8xCAir rQWHKUlhLo4jyFc/lAtucyM4iOOnZq4J5MK6V2a27zpA5tFns42Cl+oTaUsTh1P4rJwKgdy1EuzGa Yy+txkcRfMd5Gsc20JTxH+4Q5p87ZFblv/EMgu8C+39ONV5MeJLQbIoEpZibQWFqkJycNgmW/dol3 9uT7AkfPxhHRxcsreTy0AX6QsV6JI8M8e5Nvfad80didm/equ4vcyxX07rW1qwfIWWRaL/UnY+hWP 4L5NmJzeEnDgKOcf4M7SPxLiHof4qP2JIXONK0UGBQYJPShgVANHWG58nAQC02iNt/84GZlkRnzmL +U8gNOgK4kisslHl7q7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAtEV-002WvO-O9; Tue, 03 Aug 2021 12:09:20 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAtBw-002VrE-SW for linux-arm-kernel@lists.infradead.org; Tue, 03 Aug 2021 12:06:42 +0000 Received: by mail-pl1-x634.google.com with SMTP id d1so23470945pll.1 for ; Tue, 03 Aug 2021 05:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AxfbPiz+OAcunKQUJDKkMXC8YuoZmJfrrdd8jRqpaxk=; b=UXy+yxDdKtiLc0N9wSz60KM58J9GQ7PHrrI15wKth4LRDoXDgYpyEDkLNScoXfNX4J OZTipAKwywS7CODr+fO2UgPsfsgo/+OVcCm43B3n4Ofgu507IMWkiNr6l+DZW+17kBTT BdN3M2+dCB9qgs4rD+7Kbveu1I2RATNjv8Nq6GGJhSvE3npG2+s1UmlVnoeCa+4zlicj YSpIJ04y3+Z9R+1W488qhrlP9r8QLtNo5+MJXam0LHYcz3hQTknZnieZF7wKGnMSfyDU 49mzH/Wd+60E718va1p7+JfXZYIeEr7zrJPC1eMUmfb23OEodgIrltg9xTTTL5T+SGzr QXag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AxfbPiz+OAcunKQUJDKkMXC8YuoZmJfrrdd8jRqpaxk=; b=UFtBUydiSBHHl9nzJWkyQ3Rj746MRCXGT9apr1oKrZWMXibJEFjj8+etcJ5IJdmfDf w1T6G9WysyTOJrod4nQjOxaAL0gCojdP83pz/YtQosc9gjSsWdx4p7kS/xZvPeP0Ghf1 G21K4sr9BQk12XPvS+EyGmgkjqzzSHoa5TumN/GL35s9mOFf8OxlCBJV/XevVnBe1Xgp aozaokEAS/QaIPpyUVUfxcC79lp/1Fwjg0xPMC6KvLTtcVbyB2lciFQ5bUZ38eed//qq DKxpEN1y07CrxwS92+tWsYSd3UII5K70plKMUtjVz8jyzBfjm6FjZsVe3GP1LCRNaVFZ q+Kg== X-Gm-Message-State: AOAM530UESCLmH619hnvViO7Q9I90WfoxZ+hwz4pQyyGgGn3A5kpL9Iy 8fyWM0OlnAaNlQydV1H9JzM= X-Google-Smtp-Source: ABdhPJzM9f53hVzeiMglAza3PHeo7CQhGnWlK0216I+XYmn8dFkYsjjkmHml4H7YMnzUHlBpMZg5eQ== X-Received: by 2002:a63:556:: with SMTP id 83mr221918pgf.1.1627992399142; Tue, 03 Aug 2021 05:06:39 -0700 (PDT) Received: from localhost.localdomain ([156.146.35.76]) by smtp.gmail.com with ESMTPSA id n35sm7197502pfv.152.2021.08.03.05.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 05:06:38 -0700 (PDT) From: William Breathitt Gray To: jic23@kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, kernel@pengutronix.de, 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, jarkko.nikula@linux.intel.com, William Breathitt Gray Subject: [PATCH v14 00/17] Introduce the Counter character device interface Date: Tue, 3 Aug 2021 21:06:10 +0900 Message-Id: X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210803_050641_006187_68ED597B X-CRM114-Status: GOOD ( 19.77 ) 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 Changes in v14: - Initialize counter_fops owner to THIS_MODULE - Implement ops_exist_lock to prevent counter->ops use during removal - Set counter->ops to NULL on counter_unregister to indicate removal; chrdev callbacks return -ENODEV if driver is removed - Refactor counter_fops read, poll, ioctl, and release callbacks to utilize ops_exist_lock where needed and to check counter->ops - Wake up sleeping chrdev read() on counter_unregister - Move chrdev_lock introduce to the "counter: Add character device interface" patch; this is a more appropriate place to introduce this lock because the chrdev code is intended from the get-go to only allow for a single open() at a time For convenience, this patchset is also available on my personal git repo: https://gitlab.com/vilhelmgray/iio/-/tree/counter_chrdev_v14 The patches preceding "counter: Internalize sysfs interface code" are primarily cleanup and fixes that can be picked up and applied now to the IIO tree if so desired. The "counter: Internalize sysfs interface code" patch as well may be considered for pickup because it is relatively safe and makes no changes to the userspace interface. To summarize the main points of this patchset: there are no changes to the existing Counter sysfs userspace interface; a Counter character device interface is introduced that allows Counter events and associated data to be read() by userspace; the events_configure() and watch_validate() driver callbacks are introduced to support Counter events; and IRQ support is added to the 104-QUAD-8 driver, serving as an example of how to support the new Counter events functionality. William Breathitt Gray (17): counter: 104-quad-8: Return error when invalid mode during ceiling_write counter: Return error code on invalid modes counter: Standardize to ERANGE for limit exceeded errors counter: Rename counter_signal_value to counter_signal_level counter: Rename counter_count_function to counter_function counter: Internalize sysfs interface code counter: Update counter.h comments to reflect sysfs internalization docs: counter: Update to reflect sysfs internalization counter: Move counter enums to uapi header counter: Add character device interface docs: counter: Document character device interface tools/counter: Create Counter tools counter: Implement signalZ_action_component_id sysfs attribute counter: Implement *_component_id sysfs attributes counter: Implement events_queue_size sysfs attribute counter: 104-quad-8: Replace mutex with spinlock counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8 Documentation/ABI/testing/sysfs-bus-counter | 38 +- Documentation/driver-api/generic-counter.rst | 358 +++- .../userspace-api/ioctl/ioctl-number.rst | 1 + MAINTAINERS | 3 +- drivers/counter/104-quad-8.c | 728 ++++---- drivers/counter/Kconfig | 6 +- drivers/counter/Makefile | 1 + drivers/counter/counter-chrdev.c | 553 ++++++ drivers/counter/counter-chrdev.h | 14 + drivers/counter/counter-core.c | 192 +++ drivers/counter/counter-sysfs.c | 962 +++++++++++ drivers/counter/counter-sysfs.h | 13 + drivers/counter/counter.c | 1496 ----------------- drivers/counter/ftm-quaddec.c | 59 +- drivers/counter/intel-qep.c | 150 +- drivers/counter/interrupt-cnt.c | 73 +- drivers/counter/microchip-tcb-capture.c | 103 +- drivers/counter/stm32-lptimer-cnt.c | 211 ++- drivers/counter/stm32-timer-cnt.c | 147 +- drivers/counter/ti-eqep.c | 205 ++- include/linux/counter.h | 719 ++++---- include/linux/counter_enum.h | 45 - include/uapi/linux/counter.h | 154 ++ tools/Makefile | 13 +- tools/counter/Build | 1 + tools/counter/Makefile | 53 + tools/counter/counter_example.c | 93 + 27 files changed, 3623 insertions(+), 2768 deletions(-) create mode 100644 drivers/counter/counter-chrdev.c create mode 100644 drivers/counter/counter-chrdev.h create mode 100644 drivers/counter/counter-core.c create mode 100644 drivers/counter/counter-sysfs.c create mode 100644 drivers/counter/counter-sysfs.h delete mode 100644 drivers/counter/counter.c delete mode 100644 include/linux/counter_enum.h create mode 100644 include/uapi/linux/counter.h create mode 100644 tools/counter/Build create mode 100644 tools/counter/Makefile create mode 100644 tools/counter/counter_example.c -- 2.32.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel