Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933268AbcCHLr0 (ORCPT ); Tue, 8 Mar 2016 06:47:26 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:3881 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932243AbcCHLqg (ORCPT ); Tue, 8 Mar 2016 06:46:36 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Tue, 08 Mar 2016 03:45:16 -0800 From: Venkat Reddy Talla To: MyungJoo Ham , Chanwoo Choi CC: , Laxman Dewangan , Venkat Reddy Talla Subject: [PATCH 1/1] extcon: gpio: queue work only if debounce is NZ Date: Tue, 8 Mar 2016 17:15:53 +0530 Message-ID: <1457437553-566-1-git-send-email-vreddytalla@nvidia.com> X-Mailer: git-send-email 2.1.4 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 924 Lines: 30 Use queue_delayed_work only when debounce time is required to read gpio state properly, read the gpio state and set the extcon cable state in IRQ handler context if gpio settling time is not needed. Signed-off-by: Venkat Reddy Talla --- drivers/extcon/extcon-gpio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c index 279ff8f..1beb086 100644 --- a/drivers/extcon/extcon-gpio.c +++ b/drivers/extcon/extcon-gpio.c @@ -56,8 +56,12 @@ static irqreturn_t gpio_irq_handler(int irq, void *dev_id) { struct gpio_extcon_data *data = dev_id; - queue_delayed_work(system_power_efficient_wq, &data->work, + if (data->debounce_jiffies) + queue_delayed_work(system_power_efficient_wq, &data->work, data->debounce_jiffies); + else + gpio_extcon_work(&data->work.work); + return IRQ_HANDLED; } -- 2.1.4