From patchwork Tue Jun 2 14:43:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 6529221 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7CE2C0020 for ; Tue, 2 Jun 2015 14:48:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1337B204FF for ; Tue, 2 Jun 2015 14:48:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 220492052D for ; Tue, 2 Jun 2015 14:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932618AbbFBOr4 (ORCPT ); Tue, 2 Jun 2015 10:47:56 -0400 Received: from gloria.sntech.de ([95.129.55.99]:40686 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759226AbbFBOnz (ORCPT ); Tue, 2 Jun 2015 10:43:55 -0400 Received: from ip92344111.dynamic.kabel-deutschland.de ([146.52.65.17] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YznPz-00056H-DW; Tue, 02 Jun 2015 16:43:51 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] rc: gpio-ir-recv: don't sleep in irq handler Date: Tue, 02 Jun 2015 16:43:50 +0200 Message-ID: <1607281.RSg8CEJ1UJ@diego> User-Agent: KMail/4.14.1 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Don't allow sleep when getting the gpio value in the irq-handler. On my rk3288 board this results in might_sleep warnings when receiving data like: BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:1531 in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0 CPU: 0 PID: 0 Comm: swapper/0 Tainted: P 4.1.0-rc5+ #2011 Hardware name: Rockchip (Device Tree) [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x8c/0xbc) [] (dump_stack) from [] (___might_sleep+0x238/0x284) [] (___might_sleep) from [] (__might_sleep+0x90/0xa4) [] (__might_sleep) from [] (gpiod_get_raw_value_cansleep+0x28/0x44) [] (gpiod_get_raw_value_cansleep) from [] (gpio_ir_recv_irq+0x24/0x6c [gpio_ir_recv]) [] (gpio_ir_recv_irq [gpio_ir_recv]) from [] (handle_irq_event_percpu+0x164/0x550) [] (handle_irq_event_percpu) from [] (handle_irq_event+0x4c/0x6c) [] (handle_irq_event) from [] (handle_edge_irq+0x128/0x150) [] (handle_edge_irq) from [] (generic_handle_irq+0x30/0x40) [] (generic_handle_irq) from [] (rockchip_irq_demux+0x158/0x210) [] (rockchip_irq_demux) from [] (generic_handle_irq+0x30/0x40) [] (generic_handle_irq) from [] (__handle_domain_irq+0x98/0xc0) [] (__handle_domain_irq) from [] (gic_handle_irq+0x4c/0x70) [] (gic_handle_irq) from [] (__irq_svc+0x44/0x5c) Signed-off-by: Heiko Stuebner --- drivers/media/rc/gpio-ir-recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c index 229853d..e4d43cc 100644 --- a/drivers/media/rc/gpio-ir-recv.c +++ b/drivers/media/rc/gpio-ir-recv.c @@ -78,7 +78,7 @@ static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id) int rc = 0; enum raw_event_type type = IR_SPACE; - gval = gpio_get_value_cansleep(gpio_dev->gpio_nr); + gval = gpio_get_value(gpio_dev->gpio_nr); if (gval < 0) goto err_get_value;