Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp235768imw; Tue, 12 Jul 2022 18:39:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uucEOpsPF0jM++AIBBiBGlgSXxIhS9/j5ube+EnadlmWoALTIUoUhXKs1lj3RH54NK2b8F X-Received: by 2002:a05:6402:5245:b0:43a:a024:82cc with SMTP id t5-20020a056402524500b0043aa02482ccmr1496563edd.56.1657676360336; Tue, 12 Jul 2022 18:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657676360; cv=none; d=google.com; s=arc-20160816; b=q+cBJ8YKstdF0wHG1jk7Q6top2MIseqdZgl2bP+DrB2ebskA7H7RaHM7GFtMKCX6yy nsmnu2mDAKc+/yA0plFbATyjGIIpocEDHtg5aSq/AFmqPsRH4X65hJmMd3yhoZ9POs7Y gHBkr1x8JW6+sRr9YdFR7QRXvlBAJm+H/2905H0iXKWj7h/31QiXPsue1YQYLQGR6wM9 imy4n4PfWzcc7gYx3UpEvLKGF2FtuuwA0cnAVaXBnjktxW6f1yCRa2LpNN5Ejfkq436p hCyBgIM/3gSs5ngaLr5W/xukQqnh36nW2r82esr+09vqpPkIUn6549+HKq+WBpiBpYRU V1OQ== 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=qiQw5xtWuVb3JEhTrsrjdizSo7y5LocTHKSFxPGksMg=; b=XuJFBpOvHYn900EsM/BlslZJMvLB3/t2bqS9/e3s1yGF/SUPcVVtGDxIeBqYXyTw0l ILXYQIwV5K9ihZIFLAk32zhFyGBh3xGVYZZlheLs8CnOVkFGTKwcmZB0qK9FT52LlpDo yeNXzG/lCsf7YB9trZsbPIAfJnWf3xyRUZLvmuVKJOtc4YAbPsqR5i3o6iOgxe29Awf7 6GzkIP8Xi9vD+Ml6LXZo7BWGUL4235f00oS3tbuslC928WJytGTaj+ylQOz6AcUK/hHQ K4lnKFjFT+hD2Tu1mYgByl7wIiUPx/ygYPHlhIeN0n6fyeyB4PWFvr4TzNkP1+Y4Q5Xt 9SFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TPFErudO; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds18-20020a170907725200b0072b872c4714si3739007ejc.600.2022.07.12.18.38.45; Tue, 12 Jul 2022 18:39:20 -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=@gmail.com header.s=20210112 header.b=TPFErudO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233658AbiGMBhj (ORCPT + 99 others); Tue, 12 Jul 2022 21:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbiGMBhi (ORCPT ); Tue, 12 Jul 2022 21:37:38 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2F4CC7B8; Tue, 12 Jul 2022 18:37:36 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id x184so8974809pfx.2; Tue, 12 Jul 2022 18:37:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qiQw5xtWuVb3JEhTrsrjdizSo7y5LocTHKSFxPGksMg=; b=TPFErudOTtoJgISHaUQ/3LR5PKDTeM90Vn/UaSOhEK+AbmmKw1hcAy/aXR7JZNOcjZ FTG1J2/8c4+GfVZN+N5b8fU2z/WhoYuu4DmpVD9ZtY+1FLPPEeQqAhKYkJrTFD1qbC7S cOofUdALWa7zqWJqHkxwZiFuCqRIPSxPjEjBL0FckUh294gMNN2g37t1sNdDxB1Qneno D3qsDQNQoKe7v2t0jNNcLRx5dApImFdLnNfoN2DTSv8paOjhmqxGaBLbgLQzJxOaSozC +ZDe8b1VNm3yrotuplSsnieHqVrd/7rIgqxjW9vRwsr3uV7eF813VdiTTfvDA1isNvXj nOtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qiQw5xtWuVb3JEhTrsrjdizSo7y5LocTHKSFxPGksMg=; b=IJMfQ/rTT3l6l8sGgc38rglyI8QiHtvNXpZsEZ0Ml2oWICZL7ItC5sPDaGmcUPpMQR Q67GxXn5csx+y5u2LAZVn8ezGwBJQ1obExTh61AOvJyBCbuExI39zn8yE06HmKgT7ort F2FQKqvS325bzpVxi9ag4F8x2rMLsOjdjANE2cnOJ5le6UlzBJSBGF+rNn9itvqC0zlj zrSRgYGwm2XYWe/RBypeB1Kl5seUj7Iv9edidgoIvMaZ8JRH4ElB5IbxwRBaDugAPmlz vjVAlLw97RK+1RXFHTw7p77zREVYnyeWF/R1dquF9UDa7rcVesyIa//w08gXQzWpX6g8 LfEA== X-Gm-Message-State: AJIora8brq2SYvcvcx5HNR7vO90H45XmJCzWCrlGaGem0tQnw94fLgWY 8Q0Q9tRWsKw297UmBMwtEzI06+ObjFM= X-Received: by 2002:a63:9049:0:b0:412:b11b:c630 with SMTP id a70-20020a639049000000b00412b11bc630mr913236pge.175.1657676255832; Tue, 12 Jul 2022 18:37:35 -0700 (PDT) Received: from sol.home.arpa (110-174-58-111.static.tpgi.com.au. [110.174.58.111]) by smtp.gmail.com with ESMTPSA id ob2-20020a17090b390200b001ef76dbae28sm225879pjb.36.2022.07.12.18.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 18:37:35 -0700 (PDT) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org, dipenp@nvidia.com Cc: Kent Gibson Subject: [PATCH 0/6] gpiolib: cdev: code cleanup following hte integration Date: Wed, 13 Jul 2022 09:37:15 +0800 Message-Id: <20220713013721.68879-1-warthog618@gmail.com> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 This patch series is a collection of improvements to simplify the code, improve readability, and compile out unused code. There are no functional changes. The first patch is a cleanup for my recent linereq_free() fix. I noted then that the edge_detector_stop() could probably be safely moved inside the line desc check block, but wanted to keep that change minimal just in case. It can be safely moved, and so here it is. Patch 2 makes use of an existing macro to simplify a call. Patch 3 replaces some more if-else chains with switches, which is more readable (YMMV). Patch 4 reorganizes the line identification code to share code common to alternate paths. Patch 5 consolidates a number of separate flags into one. This reduces code complexity, simplifies any future edge source additions, and makes patch 6 significantly simpler. Patch 6 totally compiles out the hte specific code when CONFIG_HTE is not selected. I've based this series on gpio/for-current, as it requires the fix patch - commit c8e27a4a5136 ("gpiolib: cdev: fix null pointer dereference in linereq_free()") Happy to rebase if that doesn't suit. Dipen, I don't have any HTE compatible hardware to test with, so could you check that this still works for you? Kent Gibson (6): gpiolib: cdev: simplify linereq_free gpiolib: cdev: simplify parameter in call to hte_edge_setup gpiolib: cdev: replace if-else chains with switches gpiolib: cdev: simplify line event identification gpiolib: cdev: consolidate edge detector configuration flags gpiolib: cdev: compile out HTE unless CONFIG_HTE selected drivers/gpio/gpiolib-cdev.c | 286 +++++++++++++++++++----------------- 1 file changed, 149 insertions(+), 137 deletions(-) base-commit: 7329b071729645e243b6207e76bca2f4951c991b -- 2.37.0