Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1496071rwr; Wed, 26 Apr 2023 16:23:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5yzT0LB+oQvexWjaHwqAgYiT/PK1tuhg8DhWzCLXpzrwxnfZVWMVMxqS4KIOahG4NfonS1 X-Received: by 2002:a17:90b:3ec1:b0:24b:2b8a:d618 with SMTP id rm1-20020a17090b3ec100b0024b2b8ad618mr4666657pjb.9.1682551401632; Wed, 26 Apr 2023 16:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682551401; cv=none; d=google.com; s=arc-20160816; b=Koy4+2C74Zu8eIrwnKRHDnE2Od6QETiasiPU+EWoC8P2M0533GoWyTqNYeoh/AF8mR RSrWXeDHGcLJexIxkRxl8+Jdwf2GTGrzfqiVCp9hXwOT0GPlvVNtSq4Y1rlyPZNmZ60t 2T25qMEoPrTcYK1XlEybNwtEBj8xn1npblAgsna8rCYZOLM2BE0b6HynbxBirtZYgCcN izTowLdKGce3zXiorCbG1DMmDU0M3lv1LlFP2kHSk8YCfrGjZKWcAVGBYzH3B7QuBEVf zipCpWdCXBMQFb0BVqxFJ7FgkDk94s+b8JQoZj/d1xsQOBcZ/zzwjboJOTKs5R5zBFtc v9vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GmZe4XQJ0YjP7cw54uBUO68nCbJ9qNgc+ctEcUOTuDs=; b=GBPPTFbyo1HJCOpBzf9wOmlGISpbh1kgqi4jDEr3sqXVr9jL8yYu7JVmsSqDNJ8DqP q6OM/t604CK35vNKBMQEM9AUfLehgOCJjAnOiyh5VGI1UYBfHSi3grKoRgC0cfzOnHg2 lrfw1qZqL41+z2+Zj/DvzxgFQ5Lol811BJpiuQVhTiA+n3uBhMjaWC5HTMXezlkx8uBm DRHhSAHuGDG2A9/QV85ZNEBiYxtAcWNNtJWAKMmAkbPpNSAjEeBy0UMZos7fPhbVt44C Kuz1y3Wq2g8cSvExzTZWlod25oIVg3wa+MD9+yQ+t7K0n6fe9ehevMMHnTilwxqWMokh DGNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RHERRUh1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o20-20020a17090ac09400b00244883db2c7si18043645pjs.99.2023.04.26.16.22.43; Wed, 26 Apr 2023 16:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RHERRUh1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239830AbjDZXQL (ORCPT + 99 others); Wed, 26 Apr 2023 19:16:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239435AbjDZXQI (ORCPT ); Wed, 26 Apr 2023 19:16:08 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79EA30DA; Wed, 26 Apr 2023 16:16:05 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-64115eef620so865411b3a.1; Wed, 26 Apr 2023 16:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682550965; x=1685142965; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GmZe4XQJ0YjP7cw54uBUO68nCbJ9qNgc+ctEcUOTuDs=; b=RHERRUh1+lK0ociFRpJqgqwyeNOtTDg9+ksYO4pn+050hYcMe9qMLFxAMUavAyTG3j KTG++bzIwXJeEg5vksXpcOspRhvqhS4zkgL+8GzrpYw7lL1ZRywrOiJI2Eyhf5Ahmy3d ckvcPiMPkXaJs+6hbSiKLVuAK0W3gf3391IgTNNxKdOGiKfn1iBf5ZdOVR8N8DvTG5Mf vwX0nsQS5VlFezaFPEcGpyq47ye7DrwStNVVz/BMjpaIxSfAs9eC90PG0XNkhJM4eG/y JHRRBgyzsYUruP57UEMe9sc8Vf9Wa+R/enDK9DsHJgsMc8bg3ln471M+qlosVawtc/ka 0QvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682550965; x=1685142965; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GmZe4XQJ0YjP7cw54uBUO68nCbJ9qNgc+ctEcUOTuDs=; b=GkFUl4j7PUnz/o6IqSnTLrKtc/sBjmEM+hqnQAu9rCil684y7VZRtUVGmPw+j4HO/a P4bxHxctbx/+EsIJPzL1SJTqRAo7my1nTZlgpj4NaQi6+PoyRoRz6yeVdgF6+u/c5N+o Qd5opHvRAAxlECVnGL8VrqpjiFJfuWo38EddgkEoDVpMqd1ES5X+MQ3LbVSAqM/9Sj/O Husrg8BL5t4RFRNgITKiRVAsA1kl1HKcxCWU2TVDUmLrrQOD+U60XklNoc2cirlI38aF AHOXZv0rR7dh0YYwJcfLs5uyp3Jkpo83LrRMv9kYkiqdWa9dwpoS4s7UDdAZpGuyubsw xE7Q== X-Gm-Message-State: AC+VfDwPae2QNYs9J+xvLknqqHmTlHPTf9G0GoRkXVJ5UI0wCMnXZkRI gZmBcRF8dTNIvqmaZqOtEl69MqybfUY= X-Received: by 2002:a17:902:f688:b0:1a6:4c2b:9e7f with SMTP id l8-20020a170902f68800b001a64c2b9e7fmr4792217plg.1.1682550965206; Wed, 26 Apr 2023 16:16:05 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:f84b:79ee:8ff:d568]) by smtp.gmail.com with ESMTPSA id bv21-20020a17090af19500b002465e66256asm10300282pjb.11.2023.04.26.16.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 16:16:04 -0700 (PDT) Date: Wed, 26 Apr 2023 16:16:01 -0700 From: Dmitry Torokhov To: Jeff LaBundy Cc: Tomas Mudrunka , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Fix freeze in lm8333 i2c keyboard driver Message-ID: References: <20230425130054.591007-1-tomas.mudrunka@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FSL_HELO_FAKE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jeff, Tomas, On Tue, Apr 25, 2023 at 10:39:49AM -0500, Jeff LaBundy wrote: > Hi Tomas, > > On Tue, Apr 25, 2023 at 03:00:53PM +0200, Tomas Mudrunka wrote: > > LM8333 uses gpio interrupt line which is active-low. > > When interrupt is set to FALLING edge and button is pressed > > before driver loads, driver will miss the edge and never respond. > > To fix this we handle ONESHOT LOW interrupt rather than edge. > > > > Signed-off-by: Tomas Mudrunka > > --- > > drivers/input/keyboard/lm8333.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/input/keyboard/lm8333.c b/drivers/input/keyboard/lm8333.c > > index 7457c3220..c5770ebb2 100644 > > --- a/drivers/input/keyboard/lm8333.c > > +++ b/drivers/input/keyboard/lm8333.c > > @@ -179,7 +179,7 @@ static int lm8333_probe(struct i2c_client *client) > > } > > > > err = request_threaded_irq(client->irq, NULL, lm8333_irq_thread, > > - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, > > + IRQF_TRIGGER_LOW | IRQF_ONESHOT, > > "lm8333", lm8333); > > if (err) > > goto free_mem; > > Thanks for the patch, but this is a NAK in my opinion. > > First of all, we should not be hard-coding interrupt polarity in the > first place; that is an existing piece of technical debt in this driver. Yes, I wonder if the original hardware was limited to the edge interrupts. > > Second, changing from edge-triggered to level-triggered interrupts runs > the risk of creating an interrupt storm depending on the time it takes > the device to deassert the irq following the I2C read and the point at > which the threaded handler returns. Have you measured this? IRQF_ONESHOT ensures that the level interrupt is unmasked only when the threaded handler returns. > > Can we not simply read the interrupt status registers once at start-up > to clear any pending status? This is essentially what your change does > anyway, albeit indirectly. > Thanks. -- Dmitry