Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1735214pxu; Fri, 16 Oct 2020 22:36:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEg9/6XH24b/E1QUFUNAKwxpCq9h7XQQvdWvhBt4KdNRjGqQoGKdOChyoE89e4DizOTydI X-Received: by 2002:a17:906:cc87:: with SMTP id oq7mr7598806ejb.335.1602912988599; Fri, 16 Oct 2020 22:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602912988; cv=none; d=google.com; s=arc-20160816; b=B/NHCB4xuHbt4BH7ZgEJ5p2Awn0cXWkyMuMng8ug0CbmjHEoIeJ63Q0mXPXXiIhijx LiGaOwY+Mb3QwMGDItZkzDgHp4XWx7vjL1vBlwBErLIeDNlnfcWzwckZ5AeY1QrMzbUN x6lbgFABD34te5Q4PDDYeHk0TpcKJnO+w6aIVUwZobqgTUKrR0IfjDz3W0QViV8ue0R/ C3v/uzcQz/qg6FWXoovl6qbd0FR4nlsFWcHg6312eNWqLQx8KhyddsOiwD6iqzjGw4S2 6mXFkwNwKb6jp6XdkH7DcFYU4scy0kDdvpeOTPhhOmntRd67HKOMXZi2CVngONK6P0RN WtcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Gj5mB7zre0Qc9f9Jrd5bfLteHJQmqeFuJ23/FF59rNQ=; b=HzH77mYQLJQ54acHgLvZZ0BJcJXipsq9WaSvaBqIx+yBAy4WjlZqFr33BZDMdeT4wq cQzkWL5iJpzTPtqkgwZaanVk2Yh0w5KG9ooAdXRvdZ+jEdqWdEjZAzw077XzNHG9U2oi 5AR2+zIUbBErh7YXpM63gvtCSs51QxaeRDPgEIR+r38rDWFM6yBDyuc85DoYD4ib+SoW 3L+HPWrbqeZWlw1NyXAURitO7oL67NT81ian1ZVRCvwJLtk+D7X3cHXh+VRL7gGq4/oY Uz8pbJ74MBUExoHH+wBocl1OBx3Ez5gX7tTYGyC9lZLOh3Nb/LQU8QxsJe77H+gcAkzR X4Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JmH3Y7P5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si3317009edu.259.2020.10.16.22.36.05; Fri, 16 Oct 2020 22:36:28 -0700 (PDT) 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=pass header.i=@gmail.com header.s=20161025 header.b=JmH3Y7P5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2411472AbgJPXie (ORCPT + 99 others); Fri, 16 Oct 2020 19:38:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405965AbgJPXia (ORCPT ); Fri, 16 Oct 2020 19:38:30 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F3E2C061755; Fri, 16 Oct 2020 16:39:19 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id ds1so2177625pjb.5; Fri, 16 Oct 2020 16:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Gj5mB7zre0Qc9f9Jrd5bfLteHJQmqeFuJ23/FF59rNQ=; b=JmH3Y7P5qKixFSi9ffYm03AL0mHYma37kKkoqc2GRKISoA47GVq0avN55zZXL0g4bY YflOWVjRy8k6V3zDItvo2oQSF856001ywzRjk35G5ydkh7hDRfzuKC0pgG/2zRQW6nxi VPY97bxfrlRdxKsDYko42rk4fGJrcXPefity0TKIVaWnV9IOPxAN13s5bQagnoNmsogn Rva+Ykx4NtiOHKZ0KY2//l1PjTQ6xXP/fufaitB4qvRVjCwyBaMwjC/r2mnh12Moudtm jNgxzRGETTs42L6enYFCIveE/U7QHQJShdpT8VmECHArYFjUPS7UTPi+SzZTPAbxK8Jr NcuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Gj5mB7zre0Qc9f9Jrd5bfLteHJQmqeFuJ23/FF59rNQ=; b=hrGlj31h5xiNP3A2dec3rac1xJgKWtdVud3LU0kM1n5TNDqX8rpF/HBc62CPpJf4NG qTMRtB6Ks3nCFh5zdr5XIhQCSz1xNHEJ694g9uchhWOHcf+RcrQumOx5t/IUMIFgXgr/ EKDaoOIi4trcqYnQH0NKjPFPur+/6TBtVwBuQTvVEBbyv7qK0qfI7+zEZaE6J1zP44sR VE9wxkB46Y3LBdS1wcSWWNOppbq7ygTq3Po5pcuKr2VkkcTWEBA2IJyiJ8GGVCS/DrEH SJRgKAEDIhXgV14K/kKct6HUNkmoN6yqk0UiZ/sQPo3/rSYZBoq954hz8RSGk+QPh9s+ 1Tyw== X-Gm-Message-State: AOAM531GHX5JkUvsbGUINJ8LORg3/uN3re6jRaRMYnao3g1F8/h04BIK QdpbsztNuTspAkxv6/FisDY= X-Received: by 2002:a17:90a:fa8c:: with SMTP id cu12mr6401417pjb.140.1602891558474; Fri, 16 Oct 2020 16:39:18 -0700 (PDT) Received: from sol (106-69-182-59.dyn.iinet.net.au. [106.69.182.59]) by smtp.gmail.com with ESMTPSA id u65sm3839813pfc.11.2020.10.16.16.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2020 16:39:17 -0700 (PDT) Date: Sat, 17 Oct 2020 07:39:13 +0800 From: Kent Gibson To: Andy Shevchenko Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , Linus Walleij Subject: Re: [PATCH v2] gpiolib: cdev: document that line eflags are shared Message-ID: <20201016233913.GB5143@sol> References: <20201014062921.79112-1-warthog618@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 16, 2020 at 05:24:14PM +0300, Andy Shevchenko wrote: > On Wed, Oct 14, 2020 at 12:21 PM Kent Gibson wrote: > > > > The line.eflags field is shared so document this fact and highlight it > > throughout using READ_ONCE() and WRITE_ONCE() accessors. > > > > Also use a local copy of the eflags in edge_irq_thread() to ensure > > consistent control flow even if eflags changes. This is only a defensive > > measure as edge_irq_thread() is currently disabled when the eflags are > > changed. > > > - if (line->eflags == (GPIO_V2_LINE_FLAG_EDGE_RISING | > > - GPIO_V2_LINE_FLAG_EDGE_FALLING)) { > > + eflags = READ_ONCE(line->eflags); > > + if (eflags == (GPIO_V2_LINE_FLAG_EDGE_RISING | > > + GPIO_V2_LINE_FLAG_EDGE_FALLING)) { > > Hmm... side note: perhaps at some point > > #define GPIO_V2_LINE_FLAG_EDGE_BOTH \ > (GPIO_V2_LINE_FLAG_EDGE_RISING | GPIO_V2_LINE_FLAG_EDGE_FALLING) > > if (eflags == GPIO_V2_LINE_FLAG_EDGE_BOTH) { > > ? Yeah, that would make sense. I think I used GPIO_V2_LINE_EDGE_FLAGS, which is defined the same as your GPIO_V2_LINE_FLAG_EDGE_BOTH, here at some point, but that just looked wrong. The GPIO_V2_LINE_FLAG_EDGE_BOTH does read better. I'll add it to the todo list. Cheers, Kent.