From patchwork Thu Jun 23 10:04:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Jander X-Patchwork-Id: 908552 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5NA4CGF007641 for ; Thu, 23 Jun 2011 10:04:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758992Ab1FWKEL (ORCPT ); Thu, 23 Jun 2011 06:04:11 -0400 Received: from protonic.xs4all.nl ([213.84.116.84]:8406 "EHLO protonic.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759069Ab1FWKEK (ORCPT ); Thu, 23 Jun 2011 06:04:10 -0400 Received: from archvile.prtnl (archvile.prtnl [192.168.1.153]) by protonic.xs4all.nl (Postfix) with ESMTP id 2FD1A29EBD; Thu, 23 Jun 2011 12:01:56 +0200 (CEST) From: David Jander To: Dmitry Torokhov Cc: Grant Likely , linux-input@vger.kernel.org, David Jander Subject: [PATCH v5 2/2] Input: gpio_keys.c: Enable use with non-local GPIO chips. Date: Thu, 23 Jun 2011 12:04:15 +0200 Message-Id: <1308823455-14446-3-git-send-email-david@protonic.nl> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1308823455-14446-1-git-send-email-david@protonic.nl> References: <1308823455-14446-1-git-send-email-david@protonic.nl> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 23 Jun 2011 10:04:13 +0000 (UTC) Use a threaded interrupt handler in order to permit the handler to use a GPIO driver that causes things like I2C transactions being done inside the handler context. Also, gpio_keys_init needs to be declared as a late_initcall, to make sure all needed GPIO drivers have been loaded if the drivers are built into the kernel. Signed-off-by: David Jander --- drivers/input/keyboard/gpio_keys.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 2db7db2..689150c 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -3,7 +3,7 @@ * * Copyright 2005 Phil Blundell * - * Added OF support: + * Added OF support and enabled use with I2C GPIO expanders: * Copyright 2010, 2011 David Jander * * This program is free software; you can redistribute it and/or modify @@ -420,7 +420,7 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev, if (!button->can_disable) irqflags |= IRQF_SHARED; - error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata); + error = request_threaded_irq(irq, NULL, gpio_keys_isr, irqflags, desc, bdata); if (error < 0) { dev_err(dev, "Unable to claim irq %d; error %d\n", irq, error); @@ -760,10 +760,10 @@ static void __exit gpio_keys_exit(void) platform_driver_unregister(&gpio_keys_device_driver); } -module_init(gpio_keys_init); +late_initcall(gpio_keys_init); module_exit(gpio_keys_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Phil Blundell "); -MODULE_DESCRIPTION("Keyboard driver for CPU GPIOs"); +MODULE_DESCRIPTION("Keyboard driver for GPIOs"); MODULE_ALIAS("platform:gpio-keys");