Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1343660pxx; Fri, 30 Oct 2020 07:58:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz33D6zOQY0PKw9m9L+w3xYNS0NniYEcWCcJZG6PL2uV18oZUaoiR7Jy+X1k6KkZlvmk+BU X-Received: by 2002:a17:906:fb86:: with SMTP id lr6mr2836475ejb.510.1604069939215; Fri, 30 Oct 2020 07:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604069939; cv=none; d=google.com; s=arc-20160816; b=W1NjIg4pWtAcRhRM+ZukH+cAPUyQiTwKhBhB6LuOcjuuFZ615m5u8bbmITn9TRXQre Lyzqbo8U8dLbq1GnW/R5qxSUcIk4k8vCxWDvkIRWuqT3uHE6Qaau/LSDp1/T0Uf6XTgf z/ot7Rr2IBk3B7XM8Q+7L4KMf5pKMqUXSUWKz/rZMmoP+JwppoZlBRxhGGP3/KIr4yW4 SSKv9J9vpDrUJjMzimAfu7GyhxR6OhkQC02mm6lfGjjzlPDE2mDJo9Qva7rLRv9Gb7az 2uI3zlqXhLzCKdnBHvsjxX/fQFX7nwJphTH/25Lj0UdGyMVYN1xsG6eWzFDmbi5gGVxJ +2Xw== 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=Q691nw1GaPkDFqjRLqSBRGymD9FCcdqizVVQkT/qKrs=; b=XxajsNrUgbAnJ1EfaOXe5n7aCf07PzPZxYuAINSedByd5DyUXDjg7JVkihpTE4XIz3 StsV7RqNrCRENIuo++60EmIC86CVUWBmLTKfefHzszRBiE8KRzdibgtNhkg8Fk5BYO4G bS7aB9fmUfqwlXOHwl4q7RSU+Xv5ciPwC8xyt3bj2qDqvwT66lDPRFsxnVXpwoy5kW6C JGhUaWs8qf0XjbUXejgfDI8B39R2ZaxiLZvLKUigWN92pXc3X1KM7a39V7YO2ztlIqBa AveVhIY8iYZYlix/ijLj/+ucKBe/95ZLcTc2AR4W4tnozNHZrkPHkHJOSGv4VCw4ak6b etEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Ieu76FGZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si4375921ejx.87.2020.10.30.07.58.36; Fri, 30 Oct 2020 07:58:59 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Ieu76FGZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbgJ3OyI (ORCPT + 99 others); Fri, 30 Oct 2020 10:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726827AbgJ3OyI (ORCPT ); Fri, 30 Oct 2020 10:54:08 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7359C0613D5 for ; Fri, 30 Oct 2020 07:54:07 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id za3so9004473ejb.5 for ; Fri, 30 Oct 2020 07:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q691nw1GaPkDFqjRLqSBRGymD9FCcdqizVVQkT/qKrs=; b=Ieu76FGZe4nrpc4PkAIX5Dz2qLRwmQwgBp7/L/cmwA0z5C5IecMAhDZbj63ThJrQVD /6s8Dfklit41Djj466ondkBnfpUzP6J9mi/+irdrwtbbGC1gFqttEQUu/lvC93HqB4Fn G/LExXcbPyAJVGmyS2VjFLwP4Caoo4w15E5plTM0h58TYOIFLDsDkvnx6qs+4e0GSv0n 2Qq5d/m6zKjDlRVpafCEewxohpBSchLw3NRMu3YVrCT0Y4ew5l4Cu4D5pxGFAQbzHM46 2y64CWuUud6oSSnVOdgmbPXin9SrJ0bhZS/GVtNeUfjjxzt6bKLabkkVMHlbkIRalprH BR7w== 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=Q691nw1GaPkDFqjRLqSBRGymD9FCcdqizVVQkT/qKrs=; b=sfhXBXHZo9xeXNejyAft9Ylq9ohhSf2alJa3LsSe1OSxbi/0Sl6jJ93gMXUhG4Hr3o +4t1BR4WhKGXx82vZcY1xM9vbfFtgTAahx7wcsfVM6Zsdt/mgKTegoFe461XD2gSIY/8 TYD03GHZpt60zaINrPt13K56XXK0jZZlJgkEWg5BVnBIJKWDKowE8Mrlqz1X1ovJsypP lsfehwZqS/BRBRnAel1MQ40le8n9Anrk5YNFB8WCHlpXp2PLLNkqkjpFCnZMDNZZBO3D LB0j2kllmaUCTxle0/UNeP0xDHLluk//utu3rMJgD37ky9hW7q+IvpAWQUN5iHFSZaq/ NqeQ== X-Gm-Message-State: AOAM5318fBMw5KFYAzHTVAD9k4K+CEWmuQXvozxEsYgfYeggcDHovNPC 2WnMhPOWryGstHC6wsWNTDTf8CM0Zv1GzocL/dOM8s7bVok= X-Received: by 2002:a17:906:7d0:: with SMTP id m16mr2773722ejc.445.1604069646371; Fri, 30 Oct 2020 07:54:06 -0700 (PDT) MIME-Version: 1.0 References: <20201029084832.13933-1-warthog618@gmail.com> In-Reply-To: <20201029084832.13933-1-warthog618@gmail.com> From: Bartosz Golaszewski Date: Fri, 30 Oct 2020 15:53:55 +0100 Message-ID: Subject: Re: [PATCH] gpiolib: cdev: add GPIO_V2_LINE_FLAG_EDGE_BOTH and use it in edge_irq_thread() To: Kent Gibson Cc: LKML , linux-gpio , Linus Walleij , Andy Shevchenko Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 9:48 AM Kent Gibson wrote: > > Add GPIO_V2_LINE_FLAG_EDGE_BOTH macro and use it in edge_irq_thread() to > improve readability of edge handling cases. > > Suggested-by: Andy Shevchenko > Signed-off-by: Kent Gibson > --- > drivers/gpio/gpiolib-cdev.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c > index ea787eb3810d..5eb4435afa64 100644 > --- a/drivers/gpio/gpiolib-cdev.c > +++ b/drivers/gpio/gpiolib-cdev.c > @@ -510,6 +510,8 @@ struct linereq { > (GPIO_V2_LINE_FLAG_EDGE_RISING | \ > GPIO_V2_LINE_FLAG_EDGE_FALLING) > > +#define GPIO_V2_LINE_FLAG_EDGE_BOTH GPIO_V2_LINE_EDGE_FLAGS > + > #define GPIO_V2_LINE_VALID_FLAGS \ > (GPIO_V2_LINE_FLAG_ACTIVE_LOW | \ > GPIO_V2_LINE_DIRECTION_FLAGS | \ > @@ -569,8 +571,7 @@ static irqreturn_t edge_irq_thread(int irq, void *p) > line->timestamp_ns = 0; > > eflags = READ_ONCE(line->eflags); > - if (eflags == (GPIO_V2_LINE_FLAG_EDGE_RISING | > - GPIO_V2_LINE_FLAG_EDGE_FALLING)) { > + if (eflags == GPIO_V2_LINE_FLAG_EDGE_BOTH) { > int level = gpiod_get_value_cansleep(line->desc); > > if (level) > -- > 2.29.0 > Applied, thanks! Bartosz