From patchwork Sun Dec 23 08:32:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabor Juhos X-Patchwork-Id: 1906781 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8EA75DF215 for ; Sun, 23 Dec 2012 08:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751226Ab2LWIcM (ORCPT ); Sun, 23 Dec 2012 03:32:12 -0500 Received: from arrakis.dune.hu ([78.24.191.176]:35270 "EHLO arrakis.dune.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741Ab2LWIcL (ORCPT ); Sun, 23 Dec 2012 03:32:11 -0500 Received: from arrakis.dune.hu ([127.0.0.1]) by localhost (arrakis.dune.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WZ-AdVHyYOdn; Sun, 23 Dec 2012 09:31:19 +0100 (CET) Received: from localhost.localdomain (catvpool-576570d8.szarvasnet.hu [87.101.112.216]) by arrakis.dune.hu (Postfix) with ESMTPSA id 6F38D2801D6; Sun, 23 Dec 2012 09:31:19 +0100 (CET) From: Gabor Juhos To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Alexandre Pereira da Silva , Gabor Juhos , Subject: [PATCH] Input: gpio_keys_polled - defer probing if GPIO probing is deferred Date: Sun, 23 Dec 2012 09:32:03 +0100 Message-Id: <1356251523-28359-1-git-send-email-juhosg@openwrt.org> X-Mailer: git-send-email 1.7.10 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org If GPIO probing is deferred, the driver tries to claim an invalid GPIO line which leads to an error message like this: gpio-keys-polled buttons.2: unable to claim gpio 4294966779, err=-22 gpio-keys-polled: probe of buttons.2 failed with error -22 The patch ensures that 'gpio_keys_polled_get_devtree_pdata' returns -EPROBE_DEFER if any of the GPIOs to register are deferred. Cc: Signed-off-by: Gabor Juhos --- drivers/input/keyboard/gpio_keys_polled.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index f686fd9..cfb54cc 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -120,6 +120,12 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct if (nbuttons == 0) return NULL; + for_each_child_of_node(node, pp) { + error = of_get_gpio(pp, 0); + if (error == -EPROBE_DEFER) + goto err_out; + } + pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button), GFP_KERNEL); if (!pdata) {