Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1034770ybb; Fri, 10 Apr 2020 15:42:08 -0700 (PDT) X-Google-Smtp-Source: APiQypLLdokQu4p8Aaa4klW7WLgwOU3A+tU4nm3SVPyT7/eNahDKoYxHytqI1YpQqQvGfJ6IM+L0 X-Received: by 2002:ae9:f308:: with SMTP id p8mr6225986qkg.81.1586558528219; Fri, 10 Apr 2020 15:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586558528; cv=none; d=google.com; s=arc-20160816; b=wMngxK+Z1QyfCnwybPKDsBMR/bOjeTkZSZ/65OIawCXb0w559bewQaQV5IFwhcV/hM 8s2t9gXuWLQfRn73uIndA+6fUY6rMP2THq891mIhgHODuxFDOIus+26GCeibTsXDJ0gp 6tGjST17yobpoVKAv8bZ/68GWFjds7/NrDEEpxi6FxFZNEYDI5H52buGuul6xsbtKxyO cMbb1qMPA41X4xNXov3yNqeKiDEdCV989sNPFlmG1muAaieeBULc1ywGhWxyfwuX9Pg5 xBLneM6kQ1NxCIiB4WsZ30P4gF0P0ASCTnpjsLplkJNxFdRV3fHWjOIrJXjGN2DVxc3R 00cw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=LAO+gCgHL5tTHaVD3gJ8zq/eeHn13spJLxGQ7uaKoOM=; b=Q/Ai9+TDRY//DYEfMT77P/rgZ/02hm418xrrQScj/f2PAijGhnfJq7QWrDXUUyQsNK FMNtP4oOfl/8UyMs1biunue6yozZ9SvG9CW4j479J8fC07o6Mp+jNocnUAJwXAkfDKiI 5LjACFtZTiY1/55vWR2EDcyAqGdnUEAcDFYm/aIQz0P6qq77G85O427DO8gxrqOvDidh qDQvhQStMXh1BNT5mpLhjObTh7dqpHZh9wbBBeZF0uxXRm/8oh46tNpJVo35rWPEj5Ee 8fnLKlwbSZkjTDx4xrds27866cKui/viFJyADrRIE6fY0BgDhrhnjfPju50wBF+XllGd v9Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qMHOVxEf; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si2154607qkf.154.2020.04.10.15.41.39; Fri, 10 Apr 2020 15:42:08 -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=@gmail.com header.s=20161025 header.b=qMHOVxEf; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726676AbgDJWiO (ORCPT + 99 others); Fri, 10 Apr 2020 18:38:14 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:41500 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbgDJWiO (ORCPT ); Fri, 10 Apr 2020 18:38:14 -0400 Received: by mail-lj1-f193.google.com with SMTP id n17so3318043lji.8; Fri, 10 Apr 2020 15:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=LAO+gCgHL5tTHaVD3gJ8zq/eeHn13spJLxGQ7uaKoOM=; b=qMHOVxEfYN1XaWkmcDCFbkIq4O53uvNfdUiG/B+GNfY45U/if37tu6zjeNrLnyVFW5 Q7QNMaPDEBPAggujB0vlILbGUVcPImGQrpVEtWRsNIjs3Q2soITlhTn0+lc/cugALtFT i6CAtCgxDDtIvjaq82i8iAygVNKl6fIJHh/jO3WaTYdk2IJjmRanErCrTNmABdj1XCIz hoGwwJZcUVvaQWg3lCCWyMAynRaPeM6tdBnBUzDzSdwFwUyVqxnOKVcreAcoUdXpV9ev mhfvNbhFvXukO5t3egEX3XTjA7yuW3dmSfhGfoeiOwdwjSXbBEdlP5HSQhvB4tOqCiQY atnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LAO+gCgHL5tTHaVD3gJ8zq/eeHn13spJLxGQ7uaKoOM=; b=QuRtyRKhTGR9z/mTsSab+tW7vBTC6SZlFAwpo/Nle5kfFvlgybQP84UbdZ60bCwBQw W1b4rho/60XLYAov2eBkg1ncJPfzXYHLxy0bapgLixcqnqDQaghI/ldlZ3T/6M58rsVs XkX7TX5ng7Wy3XPGgnW8oZ+rMVYytfUQ0n7wv1D23eWzc0XQ/wgLJmHasvSDg7eaaKIv MEDP0Iz1Z9AUge77/91IgY7b4xntWXSUWYAChPtB6mS3IT25FEhNNL804AD9Ut+DIA0w osU2NxT/gxle9OmXAyw4TT/hH9pewgHns9tjL4Oq8ISuNJnBkHnuPYJKk59BjY2yQohd lfrg== X-Gm-Message-State: AGi0PubtImfl1YdsyZkrTF4HJi69wl246Nm1sYxr/M+5ZRV4UbiWrQk7 RFf6RnAYluq0ZuaYdSxGpQ0= X-Received: by 2002:a2e:b54c:: with SMTP id a12mr4184606ljn.86.1586558291061; Fri, 10 Apr 2020 15:38:11 -0700 (PDT) Received: from [192.168.2.145] (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.googlemail.com with ESMTPSA id u19sm1919503lju.83.2020.04.10.15.38.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Apr 2020 15:38:10 -0700 (PDT) Subject: Re: [PATCH v10 31/55] Input: atmel_mxt_ts - delay enabling IRQ when not using regulators To: Jiada Wang , nick@shmanahar.org, dmitry.torokhov@gmail.com, jikos@kernel.org, benjamin.tissoires@redhat.com, bsz@semihalf.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, erosca@de.adit-jv.com, Andrew_Gabbasov@mentor.com References: <20200331105051.58896-1-jiada_wang@mentor.com> <20200331105051.58896-32-jiada_wang@mentor.com> From: Dmitry Osipenko Message-ID: <46e0b0cf-63f1-4b46-dc3e-0e6610e72d75@gmail.com> Date: Sat, 11 Apr 2020 01:38:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200331105051.58896-32-jiada_wang@mentor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 31.03.2020 13:50, Jiada Wang пишет: > From: Nick Dyer > > The path of enabling the IRQ in the probe function is not safe in level > triggered operation, if it was already powered up and there is a message > waiting on the device (eg finger down) because the object table has not yet > been read. This forces the ISR into a hard loop. > > Delay enabling the interrupt until it is first needed. > > - if (data->use_retrigen_workaround) { > + /* Presence of data->irq means IRQ initialised */ > + data->irq = data->client->irq; IIRC, IRQ=0 could be a valid interrupt since this is a "virtual" interrupt number. ... > init_completion(&data->chg_completion); > @@ -3826,26 +3842,22 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) > return error; > } What about just to tell the IRQ core not to enable the interrupt handling during of the devm_request_threaded_irq()? To achieve that, add this line here: irq_set_status_flags(client->irq, IRQ_NOAUTOEN); > - error = devm_request_threaded_irq(&client->dev, client->irq, > - NULL, mxt_interrupt, IRQF_ONESHOT, > - client->name, data); ... Then the interrupt will be requested in the disabled state and it will be enabled only after the first enable_irq() invocation.