From patchwork Wed Jul 25 18:25:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 1239151 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 50AC1E006E for ; Wed, 25 Jul 2012 18:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750872Ab2GYSZW (ORCPT ); Wed, 25 Jul 2012 14:25:22 -0400 Received: from svenfoo.org ([82.94.215.22]:37296 "EHLO mail.zonque.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803Ab2GYSZV (ORCPT ); Wed, 25 Jul 2012 14:25:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.zonque.de (Postfix) with ESMTP id B7DC8C029C; Wed, 25 Jul 2012 20:25:18 +0200 (CEST) Received: from mail.zonque.de ([127.0.0.1]) by localhost (rambrand.bugwerft.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5cZAiqsM1sdP; Wed, 25 Jul 2012 20:25:18 +0200 (CEST) Received: from tamtam.coova.org (unknown [62.4.132.122]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.zonque.de (Postfix) with ESMTPSA id 4EA2CC0077; Wed, 25 Jul 2012 20:25:18 +0200 (CEST) From: Daniel Mack To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, jhovold@gmail.com, hartleys@visionengravers.com, Daniel Mack Subject: [PATCH v3 1/3] input: rotary-encoder: defer calls gpio_to_irq() Date: Wed, 25 Jul 2012 20:25:12 +0200 Message-Id: <1343240714-11399-1-git-send-email-zonque@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Don't call gpio_to_irq() on GPIOs before gpio_request() succeeded on them. This avoids Ooopses with incorrect DT bindings. Signed-off-by: Daniel Mack --- drivers/input/misc/rotary_encoder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index f07f784..00a7bda 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -163,8 +163,6 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) encoder->input = input; encoder->pdata = pdata; - encoder->irq_a = gpio_to_irq(pdata->gpio_a); - encoder->irq_b = gpio_to_irq(pdata->gpio_b); /* create and register the input driver */ input->name = pdev->name; @@ -215,6 +213,9 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) goto exit_free_gpio_a; } + encoder->irq_a = gpio_to_irq(pdata->gpio_a); + encoder->irq_b = gpio_to_irq(pdata->gpio_b); + /* request the IRQs */ if (pdata->half_period) { handler = &rotary_encoder_half_period_irq;