Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1307485pxu; Fri, 16 Oct 2020 08:51:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM0h1QE8XXVXUGt4QsNU9f+oV+pPARbCZULvu9hbmPCOGaS9dsQevYmuYRyY+SS/vwvBEZ X-Received: by 2002:a50:9f66:: with SMTP id b93mr4758412edf.201.1602863472908; Fri, 16 Oct 2020 08:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602863472; cv=none; d=google.com; s=arc-20160816; b=V6UzxoKscEYuQDUnbcktFpOnNJvN/9z+GtskxciLL2BvVo2ou4dfq9ngymw6jHGJWq Q5mYCMhK9DW4ETuolrKprSne+ZPLkTS5yv/Udg0otdERQ7SgDD/BnyOHR7JqLSWs/Sq9 Tvmt177JbJu74YKUryq7u2X03D+iazlng0bK9yOqlHnNN//s5H4F9771Oe/25jcgSjb7 Z09PCZoaz9+ARAH7aibdZhUkeCxXvaTOR8UXG/FRRxLtN7HcNfLqVall0nIEbr1OlxDF gqdS5T5wP7SgiB9msEOKn4rVx15M2OKZYk/QhxROjQ29zADrv3RaMM3nL8SqTTtxPLsp +sAA== 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=bDn8EvSa9x8an2wNno9ij6ESLlfjdp/gDnJjjs9WxmU=; b=lOvQDKBirffMy+OFDy9V6FCqaltFQettHpDTQ1651QAevKnylNwaJaQ7qKtrPVSizj 7pQKydKTVfP6ubvt/h96InuFwadrVgH3q9idgIt946gqWh2FONX7DGPri0/iaIqFZFaV epnJxWAaFZ0PaNq1OalRRAasYDZx0kHK0r9ZlWHUmavaAi3b+XDw+G0POKarkvclwmPq 6vu2CGuhVMKP9P9N4mbkc/0SoM7jGlGykIPuFgyrvXW+vLn5OABDEW1zYUH85RhL+nHf de2iKahL+U+HBMprjR94DkBPk94sHodUB10CnLstWs0vyCasaavnfYR6sNBNWYtxN/LP V73g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cm0QDu+2; 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 q22si1984859edg.439.2020.10.16.08.50.50; Fri, 16 Oct 2020 08:51:12 -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=Cm0QDu+2; 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 S2408807AbgJPOX0 (ORCPT + 99 others); Fri, 16 Oct 2020 10:23:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405369AbgJPOX0 (ORCPT ); Fri, 16 Oct 2020 10:23:26 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB1F4C061755; Fri, 16 Oct 2020 07:23:25 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id a1so1610208pjd.1; Fri, 16 Oct 2020 07:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bDn8EvSa9x8an2wNno9ij6ESLlfjdp/gDnJjjs9WxmU=; b=Cm0QDu+2zt7x2CsvysYIOUjnnYj2q/soy7Zqe6eZqQb+aAqbK65twV5wmNF1dKVQnn knJHA961m5rK2ShudtgivBA4BQ5Q+TphtpNoplzdxZYl212CndoSc1byVmZ9BXkm+r45 huG6daoRdIDTe9DxY4gcl5r5JVlwD6hNxuTZ/1DHtu1M12jnc4jwT+fYeI+SbcmlbO3M o5vwuPm1SfNBm51GlFNk7+QK8+Vku3eRGLF7ytMNTSVNKt3AqaRfavKa5DqVuBkXUwLN wnQlYwQD2Rsd1WpFxcymfK5WZ/gYaJrmUkQPPmdiZyA+d0xeniy5NxqXfBFIOckOUR1x OJIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bDn8EvSa9x8an2wNno9ij6ESLlfjdp/gDnJjjs9WxmU=; b=LNTaJIlZ/6QEvUVu/h1DbZxJdm3nR4HkldYQQRhoa9HMb1rGE3eD97UdB86Y+5V8gV xPwfb/Vqa5Bsl2YJPVy5/MjyuD8MEXvlnfGZ4mernshVtSzIHiT0dvjsGTYaaobgPqvb UuXJL0Qo8fIw/Ro+afxUTMN2PKt77nX0LJm/35XBxLVBGhlXFZURR7Uy3rqR5Gv6WS0X IBWO0mvArnTtlRCPW+PelWQTYo6x09ZHWs21Z53x9OEuZFKFifvVvUc+nyvDVydoXMVu Z3ppkIimICwAGH/AoLaI99b+ir7yPItk22YF6wZAL94606HKYEkELnlwEz3x/q+YBE+z FnvQ== X-Gm-Message-State: AOAM533WodrvmFOapIFyhiS+el46fVUlAzrWLJBGl+sNBGqrvXS1CFQa pwS8TdrQVnd1OJCAVBAKOvvoTjIv1x1RuhKwGsvLKpq4F6CyR1Br X-Received: by 2002:a17:90a:be11:: with SMTP id a17mr4090150pjs.181.1602858205436; Fri, 16 Oct 2020 07:23:25 -0700 (PDT) MIME-Version: 1.0 References: <20201014062921.79112-1-warthog618@gmail.com> In-Reply-To: <20201014062921.79112-1-warthog618@gmail.com> From: Andy Shevchenko Date: Fri, 16 Oct 2020 17:24:14 +0300 Message-ID: Subject: Re: [PATCH v2] gpiolib: cdev: document that line eflags are shared To: Kent Gibson Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , Linus Walleij Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { ? -- With Best Regards, Andy Shevchenko