Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4617170iob; Sun, 8 May 2022 19:22:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC5fLLtcvO2NO47zuWiuNlpMI3llQMsjVqZdMQ2M/VKEDDTqnEakQ+gKUsw41s2cmZ7hpV X-Received: by 2002:a17:902:7c13:b0:156:ca91:877f with SMTP id x19-20020a1709027c1300b00156ca91877fmr13988186pll.15.1652062936613; Sun, 08 May 2022 19:22:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652062936; cv=none; d=google.com; s=arc-20160816; b=iXiW92kxf8jYT7irH/N+OvyYhrA/fBfgPURtyW7H58Ia5h/PYXTTrPNBwcqF4NlV1F YpDjU2NmvShlkKfTkEzN5psjdD6KsNY4K/NSebKQ2DP0kT/9UlCa//+gM0Yh42tJrW1N CnWx1rhHCJ4immtLrVDCY2A+bUbARvUsXsQJueNu/D8xPGKISeZJdzDsFX1Q0yUC3JmA 1z1YFHVe8S0Ewu0by1NMAHR6/ByF+tsoVszYbITJf0b8flZMtklcYSaPfyT2PqyXqQ77 0XRCymAmAWVeTFCl1nYC5cJxEq4jBFZIHXr/qI6uo6DjfXaUOa02TMVf9C0N3QuyAclb koHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:message-id:date:subject:cc:from :dkim-signature; bh=GIOdOXa5ZfB2uJVmQgtKIxqW4ntVqgfvN4zvijAfGks=; b=befBsUGLs0LK0dzCmlnkdPd/QDQYYpW8J3If+kAsjawuhlGFd6sBzviRNHEe3MaP0C QUAbqDp6qVEUpULIitxwPfUELg40gh9+FzUof+FUEDvqvsZceLeEVAjXXHhFyoTyS18c RYfB02GqOs2jv2uWLUsx58QgqzaNMOTMiG9dr2W1p+n+4XbXgGR3+glQcrycvjH9vbst jIYWBbSi8xMcHN87KWBPDhA+lY9PYrtoJv1Qc5fm+ejcO54YiLRQ9IAwNC/X84gguMy4 yDVd80wxOrAm1syWV8KidGyQlpQ+K3m/k+7P2pWE4hORgEhUPjvtXNuEX9ZNCHrPtcbJ vOVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=kGUYQbBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t22-20020a62ea16000000b00505fd3b3dcbsi11841000pfh.164.2022.05.08.19.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 19:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=kGUYQbBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F2FD15C655; Sun, 8 May 2022 19:21:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389813AbiEFIK0 (ORCPT + 99 others); Fri, 6 May 2022 04:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239540AbiEFIKX (ORCPT ); Fri, 6 May 2022 04:10:23 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D433445514; Fri, 6 May 2022 01:06:41 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id cx11-20020a17090afd8b00b001d9fe5965b3so10181398pjb.3; Fri, 06 May 2022 01:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=GIOdOXa5ZfB2uJVmQgtKIxqW4ntVqgfvN4zvijAfGks=; b=kGUYQbBLRaqUISAsbY0V1LU9b5rYzU5I7SHYjf+y58iMDfVDZWLHDpQetNYI3NV7Wo lBLDwcmTnnyedxRlgjB7/xN3pgITFXN+y/k/Y4cZ2QAWgPKsMsxzVuBGQzThcdMYvfU1 1PpygFd9jq6zN/FphPU7bVtedgtpIrt98g5obSpWLPntFct+taZjH3sqO3q81x/ir6UI gaLV4oIaakhlbFmn8Vq8KTlHY1MMBd8OWNY/94HmYl8wkOImaNK1ZV5eVgK365KjbAGY tZJel8eqiapMDji9xBTTcWcuWzu7PmcLon+oGUESxUy9N1QmiW+f82N5SZ57873VkRfW 6TlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GIOdOXa5ZfB2uJVmQgtKIxqW4ntVqgfvN4zvijAfGks=; b=eT9Q2mt8xOAnGhWQuvI+V2Vf6vgty6YMa4nYeddf7GhZ/aPNO5VFNk9ZaAWc4M1v6r hpTjSSqPemEjKsIFfBW+dA7ZLKo8slgtyedn2UOa6vQUB7acZVfuxKknUzneCko2JB88 8LoaeoHW9P4ro3/6e2/y3FcOpesSD67o+nEBVgkdR3Ov6ZO1QxJkw1CaeiqNCd58DlB5 iA5z7mBzD+3FQzO0B3piq+/keyhkokuXzhLzW9fWDzbGfiBR4gu7tI7MHMFYyXJp0Twj th9IIIkTz8UenSxm07lIQOsx9dq9yVdFLjv5mDCvCa9Mn4tDkWxoxJCgMe+NqBoxfNa9 2elw== X-Gm-Message-State: AOAM532TblaK3hLrAtEZs3c4L1+LYasXkbvQxKH5uoA1vjyI+29dvJnr ESKy4lcr1a/CSxIwOwECkWAYUhEr/ABPltpGq/E= X-Received: by 2002:a17:902:70c1:b0:154:667f:e361 with SMTP id l1-20020a17090270c100b00154667fe361mr2410029plt.148.1651824401004; Fri, 06 May 2022 01:06:41 -0700 (PDT) Received: from localhost.localdomain ([183.14.31.73]) by smtp.gmail.com with ESMTPSA id r9-20020a056a00216900b0050dc7628195sm2712436pff.111.2022.05.06.01.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 01:06:40 -0700 (PDT) From: Puyou Lu Cc: stable@vger.kernel.org, Puyou Lu , Linus Walleij , Bartosz Golaszewski , Marc Zyngier , Andrew Morton , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] gpio: pca953x: fix irq_stat not updated when irq is disabled (irq_mask not set) Date: Fri, 6 May 2022 16:06:30 +0800 Message-Id: <20220506080630.4151-1-puyou.lu@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,SPOOFED_FREEMAIL_NO_RDNS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When one port's input state get inverted (eg. from low to hight) after pca953x_irq_setup but before setting irq_mask (by some other driver such as "gpio-keys"), the next inversion of this port (eg. from hight to low) will not be triggered any more (because irq_stat is not updated at the first time). Issue should be fixed after this commit. Fixes: 89ea8bbe9c3e ("gpio: pca953x.c: add interrupt handling capability") Signed-off-by: Puyou Lu --- Change since v1: add fixes tag and commit message https://lore.kernel.org/lkml/20220501092201.16411-1-puyou.lu@gmail.com/ --- drivers/gpio/gpio-pca953x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index d2fe76f3f34f..8726921a1129 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -762,11 +762,11 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendin bitmap_xor(cur_stat, new_stat, old_stat, gc->ngpio); bitmap_and(trigger, cur_stat, chip->irq_mask, gc->ngpio); + bitmap_copy(chip->irq_stat, new_stat, gc->ngpio); + if (bitmap_empty(trigger, gc->ngpio)) return false; - bitmap_copy(chip->irq_stat, new_stat, gc->ngpio); - bitmap_and(cur_stat, chip->irq_trig_fall, old_stat, gc->ngpio); bitmap_and(old_stat, chip->irq_trig_raise, new_stat, gc->ngpio); bitmap_or(new_stat, old_stat, cur_stat, gc->ngpio); -- 2.17.1