Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3161019ybi; Fri, 5 Jul 2019 02:58:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqycUcVRFb+q/fuO9kSCfemt1agocbPNrQ3ltpVlNLpjLdZxIS22SO2ODgJhbu3vy0AGSXFw X-Received: by 2002:a17:90a:bc0c:: with SMTP id w12mr4114889pjr.111.1562320716836; Fri, 05 Jul 2019 02:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562320716; cv=none; d=google.com; s=arc-20160816; b=eFDoF4qMjqFdq8PFpPVtfeV8m/Jlzb6+FY0M87iBIQCDjSe1Xt1n9HMNFiY7Cc4JqB 4lG5F0sIXFCRG8+oPHXCsKIMZjoc7/TVX5uqksrgauK8TyMibn9a3DT0KlVnz/FMDJhN hA8+TqNN3LK94ca1kLOm+FU2smRDgFiRZ2ER3QevJ9/3nACTrIjtAYsKf4YX3/NGtdEP +y3EzCs9sh5RvLnE6uUE9z4xQIM+1nJggjGAxxfZeng3HqUaxtr5ao655vFEPF4WVORU /bdQfejcQCGZz4Cr4Q0V7VjT3fAvTdexBFhLTQZz/ErgGu2cFnkcqOpgh/PCv+lmwx2U 6RXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HROQIJhsY4TQuJdqnfvqx5TwTIiaIY9u98AqrzcTE1U=; b=x1OnUpoeyTClDFN5o7AuY5x5Tt+HY+JU/eJ5KihLKnzbWWgA82EvVZRLoGAYJzbFEh DRoTs2NCuNt6IY0jzWRp0S8X2eBy0SIvqTZ6f2+6QDiuVcq4nl/lE6mN1u5ZiFLY2BgV E/EIue2EwiMdP0v0EA40OAPHAC3Q3rIVukE1QCE9Yj8cZtb5yjScx0MqD+ixPgZ91ecT g3NUpaBSTxN5oB5AzsnhmRUqgV1LlsSjk+tijvlkPPsKj3DGdPxvJrI4lz9EgGFffJKd OlDSimBX06GNSRdsrH4ag0Dps3bhw1QWHUxsRi/y8+nrmmK1CFnKu6QmPxH2N+c6vvAR bROQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=bcXmhFmt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d185si2260891pga.352.2019.07.05.02.58.22; Fri, 05 Jul 2019 02:58:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=bcXmhFmt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbfGEJdY (ORCPT + 99 others); Fri, 5 Jul 2019 05:33:24 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:40439 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726978AbfGEJdY (ORCPT ); Fri, 5 Jul 2019 05:33:24 -0400 Received: by mail-ot1-f65.google.com with SMTP id e8so8445572otl.7 for ; Fri, 05 Jul 2019 02:33:23 -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:content-transfer-encoding; bh=HROQIJhsY4TQuJdqnfvqx5TwTIiaIY9u98AqrzcTE1U=; b=bcXmhFmtX81Q+N9rH9dDCAKUMfDnSZyX8tMy4JwVU0I03xUNM4oWkTkS9xnhR5KGkA GOEL35PULJqihGmen0bInboR/NNRs7FKMm8H8jxjc9RbPcEOykxXFZPxMKwBsyptaEF+ cyucE0b/7d6US6oV2mD0/EP+bXd23muODKzcU6U4dbJKcu9kJoHssSVBeLLElWjn88tJ gFAlZkRMo4WThpBknpJ+KmKpDfH805IS5jRqRGDRIiM67O4hAGel/poQQKDv72w1g7Ui uTzOUQ7GaKJE82xZtRq4D9/axEvuRRDfI3hGCqeMn+jCX+LXlewpOZLL+4/O6BdmKE+y t9rQ== 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:content-transfer-encoding; bh=HROQIJhsY4TQuJdqnfvqx5TwTIiaIY9u98AqrzcTE1U=; b=uW9xy6QtMXk0c0ekdlmWEJhqhrJF38xMfUHSYBG0BgTmZ4HQYL3JEy3QVXxzm8KXNY OzQyQp801z7MW8zvFsroXItMFodC6V5YdtegdvfydLlFAtzC7xN2VZz7DpydrGI09i7e pQaXGbH6PbXNHwpl7In+Jg6tAUvA1MRzMkmAC5SIcsKggIH9cgdSjVbJ9464YSG/l65e msFwm5LQVodbgM6LpJiqoLvD9WD69cDnrn9w2bW/vy5aB6p/WMP2LcjfyAeQA460NDVl AsIbDzbCBTPLWSNWQNmFn1KSLVnSjU5/8WSwZj9oCqmYUpr1kme1/UPrRx3QMFM/elOi aQ0A== X-Gm-Message-State: APjAAAXxb0aK0RobG89g5r9CalQhHLmqOH8hpx8tm2oo3BEs3ka4Obqd M8qnWJBycgBzqpF0zteIC9I1q6e1IE6KSlhX8gFwyA== X-Received: by 2002:a9d:2969:: with SMTP id d96mr2138546otb.85.1562319203458; Fri, 05 Jul 2019 02:33:23 -0700 (PDT) MIME-Version: 1.0 References: <20190705093031.18182-1-michael.wu@vatics.com> In-Reply-To: <20190705093031.18182-1-michael.wu@vatics.com> From: Bartosz Golaszewski Date: Fri, 5 Jul 2019 11:33:12 +0200 Message-ID: Subject: Re: [PATCH] gpiolib: fix incorrect IRQ requesting of an active-low lineevent To: Michael Wu Cc: Linus Walleij , linux-gpio , LKML , mvp.kutali@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pt., 5 lip 2019 o 11:30 Michael Wu napisa=C5=82(a): > > When a pin is active-low, logical trigger edge should be inverted > to match the same interrupt opportunity. > > For example, a button pushed trigger falling edge in ACTIVE_HIGH > case; in ACTIVE_LOW case, the button pushed trigger rising edge. > For user space the IRQ requesting doesn't need to do any > modification except to configuring GPIOHANDLE_REQUEST_ACTIVE_LOW. > > Signed-off-by: Michael Wu > --- > drivers/gpio/gpiolib.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index e013d417a936..b98466a05091 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -956,9 +956,11 @@ static int lineevent_create(struct gpio_device *gdev= , void __user *ip) > } > > if (eflags & GPIOEVENT_REQUEST_RISING_EDGE) > - irqflags |=3D IRQF_TRIGGER_RISING; > + irqflags |=3D test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? > + IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING; > if (eflags & GPIOEVENT_REQUEST_FALLING_EDGE) > - irqflags |=3D IRQF_TRIGGER_FALLING; > + irqflags |=3D test_bit(FLAG_ACTIVE_LOW, &desc->flags) ? > + IRQ_TRIGGER_RISING : IRQF_TRIGGER_FALLING; > irqflags |=3D IRQF_ONESHOT; > > INIT_KFIFO(le->events); > -- > 2.17.1 > Is this something that causes a bug in user-space? Any scenario to reproduc= e it? Bart