Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp301277pxx; Thu, 29 Oct 2020 03:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqNnKotjXwfVQOC45Jzz4KrmOizKmpeEf7WimH9xOdq3RFE0Y8FwR27apmPoWEjUjBrlRf X-Received: by 2002:a50:8f61:: with SMTP id 88mr3151933edy.175.1603965787408; Thu, 29 Oct 2020 03:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603965787; cv=none; d=google.com; s=arc-20160816; b=PDnggeVqw8tarIaQjLLDFTuJ1ZivxaZ4EzNuPk+dRDvpHA/IzUOFUewDcCj3XT6wZ3 aX3qAXFW/SYW000h04ziONqMQxAZs9rcXT6B7Ju+o84VBcfk/XQuweXnhK9W1WvvoyHJ J0b/lM+gh3K3h9INP/geVq5BN8bP/ukm1FIXvh9q/bvGv/0qW7VAByf0RZXQg8Zm2ipF 7BdY8btQ5KTfogqY4vsECK4lh13TjKw06D55vGHkvJ8GkhPRJta7Fix0i++RHfgUkFmF R1HtOaG04adL5gg+XrdFRBunDpNwdjsscj0571I/oMs1AzQGVl0ZvZ5PZ8l5Vd4g1nIz HmGQ== 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=3NBBJNOA89yKkpMLN8TDKgLaYij/cQiFP/n4z7T6KxU=; b=szkdTNrFtpxNO+6Fd7rb5Va9dlwjw2MvijcVG/DxI54fubUqdRTyVIzL9S92Ax24d0 CaNrNmqipMSXkadfErkT98oL+TdSr7Gzwpppx9+Y/EB5YLcWm7ksuN1unGRqisC+Ojus ziYl+DrShknMenHqG5najoQDkwbb8AQgduCNxTYHNcvdtUsMJTtdw5tpCPHThX+/jy1J chQNCMEw1qXHfquvz+yeNX+EzUQMY6/Xf5GQS3+/9dEftRPp8YUV3citvlB/8RE3z7w6 0JRW1lqtbD9EysXuQNVYtge6n6EuUpiz1SA3NaK89RbidDI8kEwQpjFaCNhSOWsFbyL/ 6W0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JRHjL+rU; 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 bh5si1443728ejb.221.2020.10.29.03.02.43; Thu, 29 Oct 2020 03:03:07 -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=JRHjL+rU; 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 S1725984AbgJ2Isy (ORCPT + 99 others); Thu, 29 Oct 2020 04:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbgJ2Isy (ORCPT ); Thu, 29 Oct 2020 04:48:54 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D348FC0613CF; Thu, 29 Oct 2020 01:48:53 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id g12so1767193pgm.8; Thu, 29 Oct 2020 01:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3NBBJNOA89yKkpMLN8TDKgLaYij/cQiFP/n4z7T6KxU=; b=JRHjL+rUarLIuDrPA+dHcKat65vHo6sp5Fsw8o2pgW2w/jnUev20V2KSJ+DuDBKVjS D3b/xQV0CQdq571uA/9mt5WREQKkSyWTGvcssTS+LDKt8DCZ/aAC2MePYOx2G6TzDWLx 5ZnCqJLGHQ9qF0Q4TvBUaLF9FsdL0d7yQwMINbk+TUe4X3+XSummfm+fzCNJh7s5cYlE fQyG+3/80CW2DofXfdAecb2KBIyPT8QuRACUAPuewNMHmRKkdx1Y9rhm+jo5bZ379VTZ SCJC02VPXeEaBIP20wyk1fIW71IwB0kwSar2iY3epIZlwwqDbgg7rCPXHJdawDvi9Z4Q CwvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3NBBJNOA89yKkpMLN8TDKgLaYij/cQiFP/n4z7T6KxU=; b=c4Nge8N8JlTeGJioa1PBDhSI30m9ArED8rgF/4iFYKjrjglaKeQzmaGTfFULAA808f 5uuStnNp+mewKHW2xrmZuh5u327O552riTeZpT/SinECUHMJXxa0dybICu/8hehzcSmG p2TXF827qukmaGqQQzR7M5FfHbTYlYNn0asLFOy/9SgjyCQMorghTm9W7J+ph6d4XK5u S2B4Y59YeUFhC4g0F1PZXG+HsEW6W3HIZSNUdic1nOa3GGZqo5a3ZCLjeCRY01ai4QlO Y4TdP1yYWuXWT9Jp/TdWumvyOjkCha18hhWphFVN1PFPOxJRS3ITllcGncvZ6uj7baQD yCjA== X-Gm-Message-State: AOAM531jxj71xoq0crc5n7zVZbpMGDvhenVM1mZ5HovqRszSPDNIBcFv wk24QopYcQY0i8LACGCXH0kDWAXFMzeOBg== X-Received: by 2002:a65:40ca:: with SMTP id u10mr3023098pgp.71.1603961332919; Thu, 29 Oct 2020 01:48:52 -0700 (PDT) Received: from sol.lan (106-69-179-84.dyn.iinet.net.au. [106.69.179.84]) by smtp.gmail.com with ESMTPSA id z16sm2178493pfq.33.2020.10.29.01.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 01:48:52 -0700 (PDT) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linus.walleij@linaro.org Cc: Kent Gibson , Andy Shevchenko Subject: [PATCH] gpiolib: cdev: add GPIO_V2_LINE_FLAG_EDGE_BOTH and use it in edge_irq_thread() Date: Thu, 29 Oct 2020 16:48:32 +0800 Message-Id: <20201029084832.13933-1-warthog618@gmail.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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