From patchwork Tue Jul 24 17:38:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 1232821 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 1838FDF25A for ; Tue, 24 Jul 2012 17:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755805Ab2GXRpF (ORCPT ); Tue, 24 Jul 2012 13:45:05 -0400 Received: from svenfoo.org ([82.94.215.22]:43742 "EHLO mail.zonque.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755596Ab2GXRpF (ORCPT ); Tue, 24 Jul 2012 13:45:05 -0400 X-Greylist: delayed 404 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Jul 2012 13:45:05 EDT Received: from localhost (localhost [127.0.0.1]) by mail.zonque.de (Postfix) with ESMTP id 815B4C0298; Tue, 24 Jul 2012 19:38: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 SIAAadWpLakv; Tue, 24 Jul 2012 19:38:18 +0200 (CEST) Received: from tamtam.coova.org (unknown [62.4.132.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.zonque.de (Postfix) with ESMTPSA id 0458BC0077; Tue, 24 Jul 2012 19:38:17 +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 2/2] input: rotary-encoder: defer calls gpio_to_irq() Date: Tue, 24 Jul 2012 19:38:07 +0200 Message-Id: <1343151487-27841-2-git-send-email-zonque@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343151487-27841-1-git-send-email-zonque@gmail.com> References: <1343151487-27841-1-git-send-email-zonque@gmail.com> 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 Reviewed-by: H Hartley Sweeten Reviewed-by: still apply? --- 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 350cbd1..474b04f 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -223,8 +223,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; @@ -275,6 +273,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;