From patchwork Tue Jul 7 14:34:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 492308 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2BFF1140295 for ; Wed, 8 Jul 2015 00:35:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757737AbbGGOfR (ORCPT ); Tue, 7 Jul 2015 10:35:17 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:34013 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757793AbbGGOfP (ORCPT ); Tue, 7 Jul 2015 10:35:15 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t67EZ4hD001111; Tue, 7 Jul 2015 09:35:04 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t67EZ4IX027802; Tue, 7 Jul 2015 09:35:04 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Tue, 7 Jul 2015 09:34:50 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t67EZ3TA023381; Tue, 7 Jul 2015 09:35:03 -0500 From: Grygorii Strashko To: Linus Walleij , Alexandre Courbot CC: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= , Christian Gmeiner , , , Grygorii Strashko Subject: [PATCH] gpio: pca953x: fix nested irqs rescheduling Date: Tue, 7 Jul 2015 17:34:49 +0300 Message-ID: <1436279689-23427-1-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.4.5 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org pca953x interrupt controller functionality is implemented using nested threaded IRQs which require parent_irq to be configured properly otherwise below warning can be seen if IRQ core will try re-schedule nested IRQ: ------------[ cut here ]------------ WARNING: CPU: 1 PID: 12 at kernel/irq/manage.c:696 irq_nested_primary_handler+0x30/0x38() Primary handler called for nested irq 301 Modules linked in: uinput ipv6 smsc95xx usbnet mii imx2_wdt etnaviv(C) matrix_keypad matrix_keymap ar1021_i2c CPU: 1 PID: 12 Comm: ksoftirqd/1 Tainted: G WC 4.1.1 #9 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Backtrace: [] (dump_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x70/0xc0) [] (dump_stack) from [] (warn_slowpath_common+0x88/0xc0) [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x40/0x48) [] (warn_slowpath_fmt) from [] (irq_nested_primary_handler+0x30/0x38) [] (irq_nested_primary_handler) from [] (handle_irq_event_percpu+0x70/0x2d0) [] (handle_irq_event_percpu) from [] (handle_irq_event+0x4c/0x6c) [] (handle_irq_event) from [] (handle_simple_irq+0xa4/0xc8) [] (handle_simple_irq) from [] (resend_irqs+0x50/0x7c) [] (resend_irqs) from [] (tasklet_action+0x94/0x140) [] (tasklet_action) from [] (__do_softirq+0xa0/0x3c8) [] (__do_softirq) from [] (run_ksoftirqd+0x38/0x54) [] (run_ksoftirqd) from [] (smpboot_thread_fn+0x1f8/0x2f0) [] (smpboot_thread_fn) from [] (kthread+0xe8/0x104) [] (kthread) from [] (ret_from_fork+0x14/0x2c) ---[ end trace 96052cda48865769 ]--- The issue was reported and described in details by Lothar Waßmann and Christian Gmeiner in https://lkml.org/lkml/2014/9/9/123. Fix it by adding missed call of gpiochip_set_chained_irqchip() so GPIO IRQ chip helpers will set parent_irq for nested IRQs properly. Reported-by: Lothar Waßmann Tested-by: Christian Gmeiner Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-pca953x.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index d233eb3..50caeb1 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -570,6 +570,10 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, "could not connect irqchip to gpiochip\n"); return ret; } + + gpiochip_set_chained_irqchip(&chip->gpio_chip, + &pca953x_irq_chip, + client->irq, NULL); } return 0;