From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751842AbaEUJR7 (ORCPT ); Wed, 21 May 2014 05:17:59 -0400 Received: from smtp205.alice.it ([82.57.200.101]:6089 "EHLO smtp205.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbaEUJR5 (ORCPT ); Wed, 21 May 2014 05:17:57 -0400 Date: Wed, 21 May 2014 11:17:50 +0200 From: Antonio Ospite To: Dmitry Torokhov Cc: Alexey Khoroshilov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org, Daniel Ribeiro , Ilya Petrov , Antonio Ospite Subject: Re: [PATCH] input: pcap2: avoid calling mutex_lock() in irq handler Message-Id: <20140521111750.6e0fddfcc65522f9f3b70b66@ao2.it> In-Reply-To: <20140406202436.GA16739@core.coreip.homeip.net> References: <1396731290-7062-1-git-send-email-khoroshilov@ispras.ru> <20140406202436.GA16739@core.coreip.homeip.net> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM/Vb;]yA5\I~93>J<_`<4)A{':UrE Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 6 Apr 2014 13:24:36 -0700 Dmitry Torokhov wrote: > On Sun, Apr 06, 2014 at 12:54:50AM +0400, Alexey Khoroshilov wrote: > > pcap_keys_handler() calls ezx_pcap_read() that calls mutex_lock(). > > pcap_keys_handler() is registered as nonthreaded irq handler, > > that means sleeping function is called in irq handler. > > > > The patch makes a switch to threaded irq handling. > > Compile tested only. > > > > Found by Linux Driver Verification project (linuxtesting.org). > > > > Signed-off-by: Alexey Khoroshilov > > --- > > drivers/input/misc/pcap_keys.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/input/misc/pcap_keys.c b/drivers/input/misc/pcap_keys.c > > index cd230365166e..2a10f3a30969 100644 > > --- a/drivers/input/misc/pcap_keys.c > > +++ b/drivers/input/misc/pcap_keys.c > > @@ -79,13 +79,15 @@ static int pcap_keys_probe(struct platform_device *pdev) > > if (err) > > goto fail_allocate; > > > > - err = request_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_ONOFF), > > - pcap_keys_handler, 0, "Power key", pcap_keys); > > + err = request_threaded_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_ONOFF), > > + NULL, pcap_keys_handler, 0, > > + "Power key", pcap_keys); > > if (err) > > goto fail_register; > > > > - err = request_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_MIC), > > - pcap_keys_handler, 0, "Headphone button", pcap_keys); > > + err = request_threaded_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_MIC), > > + NULL, pcap_keys_handler, 0, > > + "Headphone button", pcap_keys); > > So I guess we do need threaded IRQ here, but I do not see the pcap's > irqchip specifying IRQCHIP_ONESHOT_SAFE so I do not think > request_threaded_irq() without IRQF_ONESHOT would succeed. > > Can someone test the change to be sure? > Tested-by: Antonio Ospite I confirm the keys still work fine with the patch applied on a 3.2 kernel. I cannot test on a newer version for now. Sorry for the delay. Ciao ciao, Antonio -- Antonio Ospite http://ao2.it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?