Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp476445pxb; Sat, 20 Feb 2021 09:54:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwv984IsTTii3AKOB5b1GMHUVPvQ4wm1z2oU6Jsso0TqUZ2Uj7JHKiJ3hEFLPOgfM6HOxL5 X-Received: by 2002:a17:907:9713:: with SMTP id jg19mr8777930ejc.129.1613843662670; Sat, 20 Feb 2021 09:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613843662; cv=none; d=google.com; s=arc-20160816; b=OZwpWDgmo27ZuhM3eO5baYvQaUZecqKPwfterYruAYxlCEUCc/qy3xzk3JEv83Ieb3 lJqw1pMWObm2VgLJru/vu0MvwUBv5BrIGgLRyWilgsX6st6GXw0iGwP1tNQwPWiWfQ8y NydtyTD34GI4yc0cfm6x5pU3RS996UqDnOxW36sYvC+EUWsy3LKsakDNJibHVzMOVaWY ayMnksTxKoMqrdUbk0zDdrpWY9qIK2ZqsRP0eobLL+/htwIQq6ys4XEJxqHPRPnDzycZ vB8PzDSE8N0lwcPv5vb4n49FoyjsozHC+QxA5KdhRX6e9kOzeUTSr9Wh5jL4YpnmxIg8 CY9w== 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=cxAy898ikaXB5b80r/PivtPGuAM/Ddrpj1pSL31gbP0=; b=RpAZeSQz2b7T2bpKh0ZC9XsMbARebEKH1jvmOhwa1oEbKOsRztQvr6C2IIls4zC001 iu26jIunoC8vBDFseHdowYVvUQZqdGKPmugOaaj1CgudPvpVTobcJo+EN1nTEVhS/pG1 vtbN8NPuTLCyEQE8C4zPMNxcYi4BUDlcXd3hwYKeqrK0p7U8uskPgVnoR+VJTw9ydXbx IQr6h1qDOBQNg4+6XaCUq5w87uAXdoyV6W7sew1szOHPpk6rUM0J3/lssfq3zofUb1Ts vVBrU2vvcdQ4l6Xe7+PBmFQ5jvB+CPAMQOPAkBveSDrE7Onkm3T63h/Zuqlv4hVfLijx XfKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=MBv+GmIm; 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 u4si9033428ejy.135.2021.02.20.09.53.57; Sat, 20 Feb 2021 09:54:22 -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=MBv+GmIm; 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 S229809AbhBTRvn (ORCPT + 99 others); Sat, 20 Feb 2021 12:51:43 -0500 Received: from vern.gendns.com ([98.142.107.122]:39320 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbhBTRvm (ORCPT ); Sat, 20 Feb 2021 12:51:42 -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=cxAy898ikaXB5b80r/PivtPGuAM/Ddrpj1pSL31gbP0=; b=MBv+GmIm+3Sdm5COSX/SJIdBQa CfnIkjFxBaCtDGZKCRL4aQU00LYN2sl+rRK0MDg/r/8P4r1nXT1Q0pQQEz4Kyi++M/Jw09h2PW/zc /K/HtuKLEaioCv/L4Enmj+OqH9Jl+VEmA1Oj4xzl4L2tdkMSMLwZ1DO1Cx+B5Up2rIZ+YwdIM7TEq geK5tuR/ivVFJqeViOGeTBXy/IVTXhUy/6M9FsGidExjULnmvtz0f4nPqM/0zHYnNTIGGvhAPWL5g +800y493IiiTVPr3suSdrJ5fmCKBpVov8H8skohMScjucnGPqXTBshhOSmPoRmC/sYX/ipLpRIop3 gCgBNraQ==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:58766 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 1lDWP8-0001tJ-DN; Sat, 20 Feb 2021 12:50:54 -0500 Subject: Re: [PATCH v8 13/22] counter: Internalize sysfs interface code To: William Breathitt Gray , jic23@kernel.org 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, 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, Dan Carpenter References: <3fc2580af0efd6312a64a0e107bd6fa758f0d466.1613131238.git.vilhelm.gray@gmail.com> From: David Lechner Message-ID: <2d9c7cfe-1f26-22b4-281f-63a7a1801452@lechnology.com> Date: Sat, 20 Feb 2021 11:50:53 -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: <3fc2580af0efd6312a64a0e107bd6fa758f0d466.1613131238.git.vilhelm.gray@gmail.com> 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/12/21 6:13 AM, William Breathitt Gray wrote: > This is a reimplementation of the Generic Counter driver interface. > There are no modifications to the Counter subsystem userspace interface, > so existing userspace applications should continue to run seamlessly. > > The purpose of this patch is to internalize the sysfs interface code > among the various counter drivers into a shared module. Counter drivers > pass and take data natively (i.e. u8, u64, etc.) and the shared counter > module handles the translation between the sysfs interface and the > device drivers. This guarantees a standard userspace interface for all > counter drivers, and helps generalize the Generic Counter driver ABI in > order to support the Generic Counter chrdev interface (introduced in a > subsequent patch) without significant changes to the existing counter > drivers. > > Note, Counter device registration is the same as before: drivers > populate a struct counter_device with components and callbacks, then > pass the structure to the devm_counter_register function. However, > what's different now is how the Counter subsystem code handles this > registration internally. > > Whereas before callbacks would interact directly with sysfs data, this > interaction is now abstracted and instead callbacks interact with native > C data types. The counter_comp structure forms the basis for Counter > extensions. > > The counter-sysfs.c file contains the code to parse through the > counter_device structure and register the requested components and > extensions. Attributes are created and populated based on type, with > respective translation functions to handle the mapping between sysfs and > the counter driver callbacks. > > The translation performed for each attribute is straightforward: the > attribute type and data is parsed from the counter_attribute structure, > the respective counter driver read/write callback is called, and sysfs > I/O is handled before or after the driver read/write function is called. > > Cc: Syed Nayyar Waris > Cc: Patrick Havelange > Cc: Kamel Bouhara > Cc: Fabrice Gasnier > Cc: Maxime Coquelin > Cc: Alexandre Torgue > Cc: David Lechner > Cc: Dan Carpenter > Signed-off-by: William Breathitt Gray > --- For TI eQEP bits... Reviewed-by: David Lechner Tested-by: David Lechner