From patchwork Wed Dec 23 18:41:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Timo_Ter=C3=A4s?= X-Patchwork-Id: 7913661 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52270BEEE5 for ; Wed, 23 Dec 2015 18:42:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7845220480 for ; Wed, 23 Dec 2015 18:42:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1BFDC2047B for ; Wed, 23 Dec 2015 18:42:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965110AbbLWSmE (ORCPT ); Wed, 23 Dec 2015 13:42:04 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:36114 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933393AbbLWSmD (ORCPT ); Wed, 23 Dec 2015 13:42:03 -0500 Received: by mail-lf0-f46.google.com with SMTP id z124so146937322lfa.3 for ; Wed, 23 Dec 2015 10:42:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=dZmZUO1ZVOM4LLcj1zUf2XlDW7iou/ca2BwD5qubkno=; b=PCm50ZnVDEcls0xFsiXgYylWZU706QfuIcZyTEeWQz1GsPJoOgyq1OjjP1lqA1VJdV +8zn9BeLAWA3z44PRTXxpeRVIzGMn9Mg1zQWoBxrUOo3FDQ3Rd+qdjtn2f5hhFhKIf6U jUu5TeyiwaQeJ7mOyEQsPHryRKu4wIqvelpK34rrHkb/1kp4TcXqBKI/pLVLvlmzN5q4 UVkC2ke+KIVNGCuuRKvhjIFLCKehTtvZI5hBy4RbCWg9V6UDzEwGJskCw3UQyoRKEOUE 0YKlEg7KyyPTXa/yqZLS8KI75kC1M57ZK/PLqBh27vOArmCKlBP1Rr0iHroe8MzGpfkN XSWw== X-Received: by 10.25.77.84 with SMTP id a81mr9062514lfb.49.1450896120968; Wed, 23 Dec 2015 10:42:00 -0800 (PST) Received: from vostro.util.wtbts.net ([2001:1bc8:101:f402:21a:9fff:fe0c:4022]) by smtp.gmail.com with ESMTPSA id mp1sm6641412lbb.43.2015.12.23.10.42.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Dec 2015 10:42:00 -0800 (PST) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: linux-input@vger.kernel.org Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= Subject: [PATCH] Input: rotary-encoder: use request_any_context_irq and gpio_get_value_cansleep Date: Wed, 23 Dec 2015 20:41:55 +0200 Message-Id: <1450896115-12422-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 2.6.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=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 This allows to use GPIO expanders behind I2C or SPI bus. Signed-off-by: Timo Teräs --- drivers/input/misc/rotary_encoder.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 8aee719..8bedd7b 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -48,8 +48,8 @@ struct rotary_encoder { static int rotary_encoder_get_state(const struct rotary_encoder_platform_data *pdata) { - int a = !!gpio_get_value(pdata->gpio_a); - int b = !!gpio_get_value(pdata->gpio_b); + int a = !!gpio_get_value_cansleep(pdata->gpio_a); + int b = !!gpio_get_value_cansleep(pdata->gpio_b); a ^= pdata->inverted_a; b ^= pdata->inverted_b; @@ -335,18 +335,18 @@ static int rotary_encoder_probe(struct platform_device *pdev) goto exit_free_gpio_b; } - err = request_irq(encoder->irq_a, handler, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, - DRV_NAME, encoder); - if (err) { + err = request_any_context_irq(encoder->irq_a, handler, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + DRV_NAME, encoder); + if (err < 0) { dev_err(dev, "unable to request IRQ %d\n", encoder->irq_a); goto exit_free_gpio_b; } - err = request_irq(encoder->irq_b, handler, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, - DRV_NAME, encoder); - if (err) { + err = request_any_context_irq(encoder->irq_b, handler, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + DRV_NAME, encoder); + if (err < 0) { dev_err(dev, "unable to request IRQ %d\n", encoder->irq_b); goto exit_free_irq_a; }