Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1127849ybh; Thu, 23 Jul 2020 00:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMfxaDXBaljXvwdX2NbTcfquC6z4Smz0/wbTuf3MKonapKTXJk4FILBkofEt8KgI2vUAUg X-Received: by 2002:a17:906:81d2:: with SMTP id e18mr3045294ejx.341.1595490293637; Thu, 23 Jul 2020 00:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595490293; cv=none; d=google.com; s=arc-20160816; b=Yo694o1CwHKM00vkP5e6MuJzFWdQtFhh6piLmPCuI556iNh62rreLco1ZGc86v1Fsi GagNpYODsTO5QF4Q0+uU60AnU+QcocjxHvKVq7W567Jf69fIGHuIYBnjDcHSAuguw0+9 dvDxiBq65317/dOGrJbMrpqP5JN55xZv68vMLP0PDwQxAUPqF+INXn+aaVnNnrQSeKWj LbG69NABP397T/53iothhtSJZL2/zdWdKMuJm2gtMg77NC22a0wpI5z9PXxsA1Ksog+e c58v3nszkhu/i/lyvh/+NLIo79G4Sn4AyODfPDJV0Z3OHn/RmP15S9XLZmAY+XKGb1P4 i81A== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lganfMGh7W90Tt7sdcSJ91khs9Am68eJ2AxDWHS92Uo=; b=XOwXG1A6dNj+u24PjZRUWJgJtDiqfmAzixULv8Em3cqJbCT+f7Apz8D0r9V/0dm2Sn zD4eL8E0NpbKs0E/mpxHdw8JMALSId1VRqZcWe9WxLXmdWrEebTnpiGbleKo32AKlZXh 50pP+uP5OT6zypzaTrqGBh11PUh2jZ1qDQ2y04FH15J+H+R+X2yz+C+BO0DmI65QgIMr 1SAyQOCuQomdHf6jb3KvOTzmn6LN4YwI4hOgoGlIxX6Wcyl1TfLkpcmG9op3x87yv3NX J9+C+EQJsyVlHcD1UybhoRPjIe+/aE+9Sd0VdKO++yRxuy4iaWakWvACILbkMMF0qumT am7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc26si1426128edb.329.2020.07.23.00.44.26; Thu, 23 Jul 2020 00:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbgGWHnd (ORCPT + 99 others); Thu, 23 Jul 2020 03:43:33 -0400 Received: from inva020.nxp.com ([92.121.34.13]:37076 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbgGWHnc (ORCPT ); Thu, 23 Jul 2020 03:43:32 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 686081A007F; Thu, 23 Jul 2020 09:43:30 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5A01B1A006F; Thu, 23 Jul 2020 09:43:30 +0200 (CEST) Received: from fsr-ub1864-014.ea.freescale.net (fsr-ub1864-014.ea.freescale.net [10.171.95.219]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id B5CEF202B6; Thu, 23 Jul 2020 09:43:29 +0200 (CEST) From: =?UTF-8?q?Horia=20Geant=C4=83?= To: Herbert Xu , Dmitry Torokhov Cc: "David S. Miller" , Rob Herring , Shawn Guo , =?UTF-8?q?Andr=C3=A9=20Draszik?= , Robin Gong , Anson Huang , Fabio Estevam , Aymen Sghaier , Adam Ford , linux-input@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, NXP Linux Team Subject: [PATCH v3 3/3] Input: snvs_pwrkey - only IRQ_HANDLED for our own events Date: Thu, 23 Jul 2020 10:43:14 +0300 Message-Id: <20200723074314.3304-4-horia.geanta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200723074314.3304-1-horia.geanta@nxp.com> References: <20200723074314.3304-1-horia.geanta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: André Draszik The snvs_pwrkey shares the SNVS LPSR status register with the snvs_rtc. This driver here should only return IRQ_HANDLED if the status register indicates that the event we're handling in the irq handler was genuinely intended for this driver. Otheriwse the interrupt subsystem will assume the interrupt was handled successfully even though it wasn't at all. Signed-off-by: André Draszik Reviewed-by: Horia Geantă Signed-off-by: Horia Geantă --- drivers/input/keyboard/snvs_pwrkey.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c index 382d2ae82c9b..980867886b34 100644 --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -82,7 +82,9 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) clk_enable(pdata->clk); regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status); - if (lp_status & SNVS_LPSR_SPO) { + lp_status &= SNVS_LPSR_SPO; + + if (lp_status) { if (pdata->minor_rev == 0) { /* * The first generation i.MX[6|7] SoCs only send an @@ -98,14 +100,14 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) mod_timer(&pdata->check_timer, jiffies + msecs_to_jiffies(DEBOUNCE_TIME)); } - } - /* clear SPO status */ - regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO); + /* clear SPO status */ + regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO); + } clk_disable(pdata->clk); - return IRQ_HANDLED; + return lp_status ? IRQ_HANDLED : IRQ_NONE; } static void imx_snvs_pwrkey_act(void *pdata) -- 2.17.1