Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp538833imw; Wed, 13 Jul 2022 03:28:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vqxJrQSqYLhMd2ivtHnPMR41/qQemTLqokIfuvhXJc1XKqmNKF5VfQDSKVCoM/pb8LSLA9 X-Received: by 2002:a05:6402:48c:b0:43a:8bc7:f440 with SMTP id k12-20020a056402048c00b0043a8bc7f440mr3799580edv.8.1657708117194; Wed, 13 Jul 2022 03:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657708117; cv=none; d=google.com; s=arc-20160816; b=xGrRtylgTWgtaVbXgu7VaEp9ztKq/FxVjYKCQVbsKkj9VpFJVGnzHpxRMshc3UoWnB DKqaLv7OWQWHGp73MxPoLoBmEsptzoEGljnwhcXO3nGW2r7acn6ioxAjyytLYHVRxLDg dWgtkDzPhReRXazH0EXyO/agj06KaGWQ5hLFxA3MivPES3x9CLxjJZtqgy9K8FmOtzU8 Yn39869B8m0Cb6w8vRs4VZHLRaSo28M+8aw1AH+rgH8YWKM52+TRS+t0pZyW6GmqpnVr EtNQysKokEKnK//x1VMRFYvj9HzqddYGSTQWa8VPl7NdX6xeJ69iG2+PH0g0byilrT2Z OdEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XicFWh548yhev8fLUn0ntz6L95VUQXkSA0mKYWVRMO4=; b=AvhkuIIP2CNYC5YdXIOXMWIH/Uce3wAFWpz4RotK4oEr+s4Vbg6n6QUtF4Ux9nKume YB/f9JgO/f9Trzk7RhlqaWsiUo7eEyQqAvzsNScNMn6rUZkFb1EYBbo7AXirNQk6WCnP wo+5W7EH04TYWKpisAWBTKiIR3jFjUg5uEg8fr7Xdby2NZx00LrmtV/3oG6lxv8hovs4 4G9NX6o3jqdhmFLSO3TueQHJ8r/tTJ0/VX03m3Iq0jhfwGnIiKvM4Z6lHkJwEJCi11fU khcj5OrFdexv9jv+955+E9hlPQj/qyVqUrHDAY9c4nsLo35FpOUBXEIgsuD/Ud5BQkB+ 8CqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="S/B1jN4B"; 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 l22-20020a1709060e1600b006f487cd3338si15619906eji.517.2022.07.13.03.28.07; Wed, 13 Jul 2022 03:28:37 -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="S/B1jN4B"; 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 S235367AbiGMKII (ORCPT + 99 others); Wed, 13 Jul 2022 06:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235068AbiGMKIH (ORCPT ); Wed, 13 Jul 2022 06:08:07 -0400 Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82B07FA1CC; Wed, 13 Jul 2022 03:08:06 -0700 (PDT) Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-31c89653790so106951107b3.13; Wed, 13 Jul 2022 03:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XicFWh548yhev8fLUn0ntz6L95VUQXkSA0mKYWVRMO4=; b=S/B1jN4BpYl8UksrkGmxDgTB5l8YqJiUeXobdbVONSfhDqpnqMTiZx7Zuxgxd6UHa8 Vh6VAjo88TkG+GfN/inSNXHM46byjTgTDeni87b8t1IUAr5wm8wKHCJSnUjkzMMhLIWl zucPQIfG3EMx7T/u6nDNBZqycqIFmu2cPxI4m6TozPf//xDuT3z4j+6gnRqTa1OkWdBp p/oknD/1VPLsekVbPSiBqwzA3G7Pc0aQ8AaiI68Lm2+ZBQIyR52fgYNPDAkmqh/gFzWY YMH+TtQmzXBB1RnBcid2GK+8seuREcV0vfjNFDecPalxFvpXhHycNJSDhDoCVJFZHFuJ +ksA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XicFWh548yhev8fLUn0ntz6L95VUQXkSA0mKYWVRMO4=; b=DbLMnshxljx7IbSLOchdd61M96ERBx+TRJLesgebj8EwyxKjWFYAvY/85h0EZEhplW duDK7u0cNk7GG7wdmXY3WgYbDcX+TLklHVJwfbz0P+HroyLJhTU+Wym6GHefXVeAZpxn y5V/6j28s47sRD+3vXmDbZ9Tyy+u8aje9TWdv9Nb3o/X1D7ZjOQWpXqAe2AcEuL5qONp yLkxCpVM6MpnN5wxUDiyynWTt6iChrTGW83ZguFQhOEkReLBLjsFEeCV+to7gnk8xi7e O8X9Monmwhi+893HwgBk81hD9lARSTACuquzBgYn2mFkRdtylq4YcCJpgJRlhodTDOcp Fi1Q== X-Gm-Message-State: AJIora8dTHoW2+nY5hUWioHkxuY9sbSUDYJT9Ef3Xi3IaxFxzqY/7N60 s02Vz4qDJVVo6BYyU4LV8vYf7RyVuhIdns8DiEY= X-Received: by 2002:a81:468b:0:b0:318:4cac:6576 with SMTP id t133-20020a81468b000000b003184cac6576mr3174506ywa.277.1657706885696; Wed, 13 Jul 2022 03:08:05 -0700 (PDT) MIME-Version: 1.0 References: <20220713013721.68879-1-warthog618@gmail.com> <20220713013721.68879-6-warthog618@gmail.com> In-Reply-To: <20220713013721.68879-6-warthog618@gmail.com> From: Andy Shevchenko Date: Wed, 13 Jul 2022 12:07:29 +0200 Message-ID: Subject: Re: [PATCH 5/6] gpiolib: cdev: consolidate edge detector configuration flags To: Kent Gibson Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , Linus Walleij , Dipen Patel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Wed, Jul 13, 2022 at 3:39 AM Kent Gibson wrote: > > Combine the polarity_change flag, struct line eflags, and hte enable > flag into a single flag variable. > > The combination of these flags describes the configuration state > of the edge detector, so formalize and clarify that by combining > them into a single variable, edflags, in struct line. > > The edflags is a subset of the GPIO_V2_LINE_FLAGsb relevant to > the edge detector, and is also a superset of the eflags it replaces. > The eflags name is still used to describe the subset of edflags > corresponding to the rising/falling edge flags where edflags is > masked down to that subset. > > This consolidation reduces the number of variables being passed, > simplifies state comparisons, and provides a more extensible > foundation should additional edge sources be integrated in the > future. I believe that you have checked this from a locking perspective, so we won't have worse lock contamination, if any. ... > struct linereq *lr; > struct gpio_v2_line_event le; > int level; > - u64 eflags; > + u64 edflags; I would at the same time move it up before `int level;`. ... > + int level = -1, diff_seqno; > + u64 eflags, edflags = READ_ONCE(line->edflags); Ditto. ... > u32 debounce_period_us; > unsigned long irqflags = 0; > int irq, ret; > + u64 eflags; Ditto for similarity. -- With Best Regards, Andy Shevchenko