Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp892713pxb; Wed, 27 Oct 2021 14:36:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznVKcl9iQIZbbvLW5WwtCUFWz9IDZfv+/sT/hyGuUhIxoHI9nR1SyZiAY4umqaReeTeXEq X-Received: by 2002:a17:906:5d09:: with SMTP id g9mr143767ejt.330.1635370478192; Wed, 27 Oct 2021 14:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370478; cv=none; d=google.com; s=arc-20160816; b=Fqt9LO8VUuvrzqw8THzjnPPFSmNZWBp6ivLkLDRw7qo75JPndWx6LmwrN+B6mQbkwk +TNb2z5GNlb0CMbOuXOPrDqdDXJucJJFumBdm88FCPRQ9ecrefTjvUz0HTLL3TK7Z96W JwxD/pYgbwmzNbly9/zxYVvyz9kf+f/dUSyxF3V434MD6NHNyaOVBFxyhcBkBro2yaZy 6Rmyn+YjshkATWTzvtXt2B2kly/PEZxl79QSqp2g52IY1l5bwXrVuGZPkEikUzlWCmsx LBe1coEiyU5xa2W1MREQY4NjF8OkTTlr9Z02IK9C+haPEIIkoyxMnKnHNUrNXuMUzzVD 4JPQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oZEQ9bOWAal0AuBrRE1j7DkT1eWE/nOboo6w+vXEBA4=; b=MwyTf7+aV/fWn/FqJMhO3uW2iYZ5I0hgQp3/OWENnK3kirWl9Mo+ec3AkqiZFev7nv RuWJQWJ+rFxaiuNPTFU3ejc0cQ2yX47fOnTi8UdSDktE1HW+QBjA7MZjFsmdSOH3uOqc 2yW6vMk/xgiKweHRTT6Q6F0nLIRbdvLaF1pXI0HH51FzWoMTvlLct8ooKqpivVydNhBd eBw+PteGDqOAo+qpx6LXcGcpj5ZTGV3AhVgCmDHwHv5vZ6wBMJrgccv8a2EXFsrGH3ZX FopVvgrUagH4lPdNnwVpkpVtyVRJNqcOVRllnhZO0Fe04w/R9oEYsPTn+DpedZ7T+1pa O/IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=RdM13EQS; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si1165720edq.594.2021.10.27.14.34.15; Wed, 27 Oct 2021 14:34:38 -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=@trvn.ru header.s=mail header.b=RdM13EQS; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239212AbhJ0SR5 (ORCPT + 97 others); Wed, 27 Oct 2021 14:17:57 -0400 Received: from box.trvn.ru ([194.87.146.52]:38631 "EHLO box.trvn.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231782AbhJ0SR4 (ORCPT ); Wed, 27 Oct 2021 14:17:56 -0400 Received: from authenticated-user (box.trvn.ru [194.87.146.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.trvn.ru (Postfix) with ESMTPSA id 2230C4047A; Wed, 27 Oct 2021 23:15:24 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1635358524; bh=8ur6ICJjhsS/B9AMUYVjZwUeQ8Fruu3EV0crM9k9t8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RdM13EQS5ZdPyrCODJuOwTm1+Yjlly7H3j12t7/K6vo6zTyyY5rE4MniUZsZJ7c3b q3RGTxHp4thKHxqlvyjgkw65BJ6z83lQq7cOliBOosAIDzKRR/0uAlUOjX5nwHgj5p Aih+RRy3xCM25KoVH+2/QytGyVcXxrdD6u+wFNhpVAaPxr4ZlY8aXESogVORkR7U5W At6E0FQGiRBb0QdMDN1APu6LX6fJ0O+m21gmVfhf60X6DGUJup1GRWYOT379QffFx7 C7/kMiS3S/v0yg6gajNQ97BtFrCL+X2mOxPT8FqEhtkl//BUtoMDQxsyHOuLXz8xcl G9W9sZO4Y8ZOQ== From: Nikita Travkin To: dmitry.torokhov@gmail.com Cc: robh+dt@kernel.org, Michael.Srba@seznam.cz, linus.walleij@linaro.org, broonie@kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Nikita Travkin Subject: [PATCH 1/6] input: touchscreen: zinitix: Make sure the IRQ is allocated before it gets enabled Date: Wed, 27 Oct 2021 23:13:45 +0500 Message-Id: <20211027181350.91630-2-nikita@trvn.ru> In-Reply-To: <20211027181350.91630-1-nikita@trvn.ru> References: <20211027181350.91630-1-nikita@trvn.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since irq request is the last thing in the driver probe, it happens later than the input device registration. This means that there is a small time window where if the open method is called the driver will attempt to enable not yet available irq. Fix that by moving the irq request before the input device registration. Fixes: 26822652c85e ("Input: add zinitix touchscreen driver") Signed-off-by: Nikita Travkin --- drivers/input/touchscreen/zinitix.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c index b8d901099378..1e70b8d2a8d7 100644 --- a/drivers/input/touchscreen/zinitix.c +++ b/drivers/input/touchscreen/zinitix.c @@ -488,6 +488,15 @@ static int zinitix_ts_probe(struct i2c_client *client) return error; } + error = devm_request_threaded_irq(&client->dev, client->irq, + NULL, zinitix_ts_irq_handler, + IRQF_ONESHOT | IRQF_NO_AUTOEN, + client->name, bt541); + if (error) { + dev_err(&client->dev, "Failed to request IRQ: %d\n", error); + return error; + } + error = zinitix_init_input_dev(bt541); if (error) { dev_err(&client->dev, @@ -513,15 +522,6 @@ static int zinitix_ts_probe(struct i2c_client *client) return -EINVAL; } - error = devm_request_threaded_irq(&client->dev, client->irq, - NULL, zinitix_ts_irq_handler, - IRQF_ONESHOT | IRQF_NO_AUTOEN, - client->name, bt541); - if (error) { - dev_err(&client->dev, "Failed to request IRQ: %d\n", error); - return error; - } - return 0; } -- 2.30.2