Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp72482imw; Wed, 13 Jul 2022 19:27:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sDoThEHbsNwdA4aMlp31jkfkfXjX7OqnOLVmU3UMKhLfIciRxw3q8wcoHKa1WRV834a6MC X-Received: by 2002:a05:6a00:815:b0:52a:dea8:269b with SMTP id m21-20020a056a00081500b0052adea8269bmr6234354pfk.66.1657765674750; Wed, 13 Jul 2022 19:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657765674; cv=none; d=google.com; s=arc-20160816; b=RwDiug9Lk2z5ynACCadPMUcjmWo3Kx+LijedH7jSeN36BCK0lxpKVkIj1UDjXrEZh+ zIqOjguo97qHGMDl3fpWbZvmgwt+j7IQ5CBY5bi7IXA0pFWRqdXAJu8DenUXw/ddkVy9 5d/ZyxyqiuEk/Df7x3l7rsYbXJkpWl0ePAxq9PrZqqVm23/PODbS8f1UUdxhjN1bPG4u VuCDwqf2xkZKJRg1Un/x815xM1fwgqgy2VaJYj6hx1DTNRp3bUgAyUNuQS/28nuU7ueY UOlKcDjsnvvVKOV7gtlSBmqL0v0INB+Ohsw1TjpsKu50WGx/UbNr21L6BKIpmwnDitcd QSpA== 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=KbXWRxkBF4v4bahA1QQdo+LHzdrxElL+2e0ry4cAShE=; b=Ktub4fiGuQqPedLtoau0KY3s0gvWWTnngf4s8QyOpa0D8Vfa/6hsI96rkpTkRznnu0 HbrZVPaG6Eyn32QExyys2wMVh7DWftH46Z1dxsOq3HsYkgu3ZVpPv1Ex+Lq3a9f4RH87 b/zMBWwabv57xrjx6aqhxMI1KlpktOBmbEgIp5jg2mAd+s+O19ugwS94giol4S/xzK4j h9V3YDgxZ+b96Tf3urwYpqT+h95EIi0QBR+OZlE1wDRxgOmh9yb/d90QXjXmJpoZktOn mNpmbo9bg5A+5p6+0G6ZTW8CJ7HpZ+13ZyOwDeKO02pI0dJAOmvcy6VEJDRj1VaT12Os 9z6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZRXUZjNw; 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 u11-20020a63d34b000000b00415ea6ac484si269791pgi.372.2022.07.13.19.27.42; Wed, 13 Jul 2022 19:27:54 -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=ZRXUZjNw; 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 S232250AbiGNCDm (ORCPT + 99 others); Wed, 13 Jul 2022 22:03:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbiGNCDl (ORCPT ); Wed, 13 Jul 2022 22:03:41 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 468C15F51; Wed, 13 Jul 2022 19:03:40 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id o31-20020a17090a0a2200b001ef7bd037bbso1089823pjo.0; Wed, 13 Jul 2022 19:03:40 -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=KbXWRxkBF4v4bahA1QQdo+LHzdrxElL+2e0ry4cAShE=; b=ZRXUZjNwJF02iqB+QYx3KKKBSUmaAYDvKv3WDoXuqEsf7/r7wHWCh/pjHE/1/cQfyb SIlfjMxT+QX922D0YdBWjdJbdo/QQlAss9ZqfS1A9aIh9/8A8wsY0t8uN6o6vKmNsxEm ueGsDp/LMhzEfxf3regO105BaZyTeC4XOrZG8IJxRzQM5m6DkMGGiToUOEF5o2qlbygc gWAeDJjJKDCdiLcrLzKdrurhbScBQEgR7s09p+4Ynif7z78xYkywL6HArsEEEQjobLZ7 RL/yI296SdOFN0diRQbCilPctIJcDMDS5SEoS1x+gHWZv9Ria9LbpzWMx7pj5h98BG6h hBlQ== 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=KbXWRxkBF4v4bahA1QQdo+LHzdrxElL+2e0ry4cAShE=; b=XsfzOTeMSzAAgyqyvTvfI8nOIow1KYrKMw8CN10ZmViP3CEi/2JRd8bttNf6Dku+JO NV2vzrWB/g7PO5dzQxED/7Ao0WnmEdl+gjBfcQhmPfru+dylX4pkqK/Vi4DKkW0i4MPz lq30Q1dRdDvpumSisXVXg0zGQYJGKI20Jzo1NpVWNrVHmsvShglqJWW1FiWkNk5+nJyf L3aXRG9r2N3Nf4OfLSfpn3wAxKdOKSSiK/IJbIgb8MnxxZubVi2Ple0j2saSUvxBfV1n 4RtaH4hfsvOcqwBu0IGRceYxYQTh1TMCcN47TsdP7u9ZRaHt5Uk+l6jNCWRe+QP/07Bh UvRg== X-Gm-Message-State: AJIora8xUECoHUY26iRCSTmc3p33z34ULWoBmTzm0XIjS20AiEksCGFf 4Zd76CYCxYCfgVe6VDEfimHd2vzgaMg= X-Received: by 2002:a17:902:ce88:b0:16c:1b1e:71b4 with SMTP id f8-20020a170902ce8800b0016c1b1e71b4mr6148710plg.153.1657764219481; Wed, 13 Jul 2022 19:03:39 -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 i137-20020a62878f000000b0052542cbff9dsm230886pfe.99.2022.07.13.19.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 19:03:38 -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, andy.shevchenko@gmail.com Cc: Kent Gibson Subject: [PATCH v2 0/6] gpiolib: cdev: code cleanup following hte integration Date: Thu, 14 Jul 2022 10:03:13 +0800 Message-Id: <20220714020319.72952-1-warthog618@gmail.com> X-Mailer: git-send-email 2.37.1 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? Changes v1 -> v2: Address Andy's review comments, specifically - Patch 4 move ternary initializer into a helper function. - Patch 5 variable declaration ordering. - Patch 6 remove obsoleted comment and tidy some if expressions. 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 | 291 +++++++++++++++++++----------------- 1 file changed, 151 insertions(+), 140 deletions(-) base-commit: 7329b071729645e243b6207e76bca2f4951c991b -- 2.37.1