From patchwork Tue Sep 9 08:33:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Lothar_Wa=C3=9Fmann?= X-Patchwork-Id: 4866731 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 711769F3EC for ; Tue, 9 Sep 2014 08:33:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C865720149 for ; Tue, 9 Sep 2014 08:33:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29D7820145 for ; Tue, 9 Sep 2014 08:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753322AbaIIIdJ (ORCPT ); Tue, 9 Sep 2014 04:33:09 -0400 Received: from mail.karo-electronics.de ([81.173.242.67]:56978 "EHLO mail.karo-electronics.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751300AbaIIIdH (ORCPT ); Tue, 9 Sep 2014 04:33:07 -0400 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dmitry Torokhov , Paul Gortmaker , =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= Subject: [PATCH] Input: matrix_keypad - make driver useable with GPIO drivers requiring threaded irqs Date: Tue, 9 Sep 2014 10:33:04 +0200 Message-Id: <1410251584-5031-1-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 When trying to use the matrix-keypad driver with GPIO drivers that require nested irq handlers (e.g. I2C GPIO adapters like PCA9554), request_irq() fails because the GPIO driver requires a threaded interrupt handler. Use request_any_context_irq() to be able to use any GPIO driver as keypad driver. Signed-off-by: Lothar Waßmann --- drivers/input/keyboard/matrix_keypad.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 8d2e19e..e651fa6 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -332,23 +332,24 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev, } if (pdata->clustered_irq > 0) { - err = request_irq(pdata->clustered_irq, + err = request_any_context_irq(pdata->clustered_irq, matrix_keypad_interrupt, pdata->clustered_irq_flags, "matrix-keypad", keypad); - if (err) { + if (err < 0) { dev_err(&pdev->dev, "Unable to acquire clustered interrupt\n"); goto err_free_rows; } } else { for (i = 0; i < pdata->num_row_gpios; i++) { - err = request_irq(gpio_to_irq(pdata->row_gpios[i]), + err = request_any_context_irq( + gpio_to_irq(pdata->row_gpios[i]), matrix_keypad_interrupt, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "matrix-keypad", keypad); - if (err) { + if (err < 0) { dev_err(&pdev->dev, "Unable to acquire interrupt for GPIO line %i\n", pdata->row_gpios[i]);