Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4160713rwl; Mon, 10 Apr 2023 07:06:02 -0700 (PDT) X-Google-Smtp-Source: AKy350a5eaxb/PARvSvsCdCrxuTkmhcb7VYqzjuRzMGjhE+bpBtm+NR5JNoyW5e3/m/THM1t0DSL X-Received: by 2002:aa7:d497:0:b0:504:aaba:9b0c with SMTP id b23-20020aa7d497000000b00504aaba9b0cmr2081942edr.31.1681135562063; Mon, 10 Apr 2023 07:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681135562; cv=none; d=google.com; s=arc-20160816; b=gFNV4JLYkmCO3gmJMzpWlsC7HRFqPT42yAT4qhXNfQnW2GckVHVKCvM24ctdF+z0s+ hfs9qzp4UyTxZdcIAE8ELQ2xEGMqucp8Zwm3LHaG4cXFN0Yuw2mCzE8WYxcaO748F0Ov 8ocncJck+UZCCVeZZ64/7vxhWeeCuyIWOGE/+p00w2fDysRXm7oEWS533d+uSdwoBNuk zEmB9roYCFXJaN4zc3DQgMgVxJfKBwOam+L38rf+/8FOE98QRChARof5xlXpz6l/l4zw p2GAHX7H08lS6v7wBSfkpsubrAbmt0zR/wEQ9Pzc/tQ/YpRGnZDUVJCW9DgTip/D9XYj DYJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=h6xr4dsIfUHocIJG6ABB+pNClK5aTEQgtpf+Nzcgpg0=; b=QHMAigyrOTgag1SYUjLKo6tu0GvOWD5LQgkzuHHRx1TcXtzRIlha3vyQXSdm5f+Ueu 5YZ0QQMzUMjlQfdpseGPUorDojx2wjjfhvAixNGx/qhRk0wu84HAUAdhEBs9Gcu4QSHa s4XD3UGM8LybDC5ZBwNaPU9vaDD5ymqygWncsZ/v5mKCk+W79xi7ZmajLQvY/C6eTkDG EPfGsB67M9Mp8fISp9Lng3V0cw1ztN2jNcN4b8Uu/v7LOcbKIfW0DnFLMKAYJnXVKl1X EbaQkUA0B7N8GI/5cLuxWnmq5DzhNQrvXmiIRM6D3GK8zHB+J/Y9j7QesQPpcTxhHU4L uIPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jdpoKBtH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba26-20020a0564021ada00b005021f0d575fsi10125100edb.678.2023.04.10.07.05.37; Mon, 10 Apr 2023 07:06:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jdpoKBtH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbjDJODk (ORCPT + 99 others); Mon, 10 Apr 2023 10:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbjDJODf (ORCPT ); Mon, 10 Apr 2023 10:03:35 -0400 Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05B9C49FC for ; Mon, 10 Apr 2023 07:03:20 -0700 (PDT) Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-5491fa028adso424051017b3.10 for ; Mon, 10 Apr 2023 07:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681135399; x=1683727399; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=h6xr4dsIfUHocIJG6ABB+pNClK5aTEQgtpf+Nzcgpg0=; b=jdpoKBtHGpBjLql6hXxSl8zDPn2P3XiyI8XtHmZHRCE03v4ylTtc+lWRYVV+aBczxy GjwsGPsThFxTqsQk1lMxFS89y3mn+FU276qKYlLNcp+pxPjQKHkDmy8PT5pgKrxOXWJb W5pyTBe5SP/ZdCdf0s2UwsrROcQ12IzgWMJwu20z1jIVFjthT3YA+DD1Q6O8kuL8r+R1 x8c5T64pVrJg6aWrYDJxTE/7XfJxDsLnlIost+KS4OPOSNNEdWh1doiPHwoO0m22hdxk C9RTiJh2OaF66YLhZvcS2dIPv9Ra6+986AeeslG+fp2elupF9MNl9rTKYpXkMJm11Ixr 224Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681135399; x=1683727399; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=h6xr4dsIfUHocIJG6ABB+pNClK5aTEQgtpf+Nzcgpg0=; b=1e7s5lU2jtBfOyMyt4J9Lqsf7G8VnIMAVJb0yGg2dk/ih2u61bmPkbV6ckxBc3xMvE VVU0Alu8pIeBpwv2HxiUS05+MLjr7KvunROJ4/M7epQL8pC6XfKUARSGpx4QOKVcU9/p O+nomgJU9eY97PkoOb48ZjOw+Zs2n7huoio1DnXPHLk3iftg71COmDh0Xlb0FJ9XDWba 9ezDg4a4S4AMW5FiVtCR4kcF/AVVeQb5UFEsE6RDsaoSu4lXKjek6RWGSqDNd28vQ8HC RKB1qdcqEu9J0g9201MZKtoD9x2H4+Sgue+0OQpn+t4dFARX+qQsLwDpLt+Vto1UhYYY cZ1g== X-Gm-Message-State: AAQBX9cYVh+fB7ehbvrd17dC26qEDtaGGPsg2AQk7hz3RmMpGZptyTfl n1WjJzULUPLkTUirY3Gg5U1Dmw== X-Received: by 2002:a0d:d614:0:b0:54e:84f6:6669 with SMTP id y20-20020a0dd614000000b0054e84f66669mr6953363ywd.49.1681135398537; Mon, 10 Apr 2023 07:03:18 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id cm24-20020a05690c0c9800b00545a08184c8sm2821000ywb.88.2023.04.10.07.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 07:03:18 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Andy Shevchenko , Johannes Berg , Jonathan Cameron , Andrew Morton , Al Viro , Nathan Chancellor , Nick Desaulniers , William Breathitt Gray Subject: [PATCH v3 0/3] Refactor 104-quad-8 to match device operations Date: Mon, 10 Apr 2023 10:03:10 -0400 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes in v3: - Add __always_inline attribute for quad8_control_register_update() Changes in v2: - Drop FIELD_MODIFY() macro introduction; u8p_replace_bits() is utilized instead for the same purpose - Replace FIELD_PREP() and FIELD_GET() with u8_encode_bits() and u8_get_bits() - Replace FIELD_MODIFY() with u8p_replace_bits() - Wrap up control register update in quad8_control_register_update() - Utilize ioread8_rep() and iowrite8_rep() to read and write counter data The 104-quad-8 driver was initially introduced to the IIO subsystem where it didn't quite fit with the existing paradigm [0]; these differences eventually led to the creation of the Counter subsystem[1]. As a result of its awkward beginnings, the design of the 104-quad-8 driver was structured around maintaining abstract state buffers that would eventually be converted to match the actual device registers states on-the-fly as needed. The original design approach for the 104-quad-8 driver was neither efficient nor easy to troubleshoot, but it did allow us to focus on implementing and supporting necessary APIs for the nascent Counter subsystem. Now that development for the 104-quad-8 driver has shifted to maintenance, it is a good time to refactor and clean up the code to match closer to what is actually happening on the device. This patchset is an attempt to rectify the situation as such. The primary change is a transition from maintaining individual configuration states independently, to storing buffers of the device register configurations. To that end, the bitfield API is leveraged to access and retrieve field states. Some helper functions are introduced as well to abstract the handling of the PR, FLAG, PSC, and control registers. [0] https://lore.kernel.org/r/b43e2942b763b87afc85bfa9fe36e5695cba4c44.1475079578.git.vilhelm.gray@gmail.com/ [1] https://lore.kernel.org/r/cover.1554184734.git.vilhelm.gray@gmail.com/ William Breathitt Gray (3): counter: 104-quad-8: Utilize bitfield access macros counter: 104-quad-8: Refactor to buffer states for CMR, IOR, and IDR counter: 104-quad-8: Utilize helper functions to handle PR, FLAG and PSC drivers/counter/104-quad-8.c | 537 +++++++++++++++++------------------ 1 file changed, 258 insertions(+), 279 deletions(-) base-commit: 09a9639e56c01c7a00d6c0ca63f4c7c41abe075d -- 2.39.2