From patchwork Thu Nov 8 13:40:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1715931 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 D5D12DF2A2 for ; Thu, 8 Nov 2012 13:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755695Ab2KHNmZ (ORCPT ); Thu, 8 Nov 2012 08:42:25 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:63380 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755642Ab2KHNmX (ORCPT ); Thu, 8 Nov 2012 08:42:23 -0500 Received: by mail-pa0-f46.google.com with SMTP id hz1so1994499pad.19 for ; Thu, 08 Nov 2012 05:42:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=l4Y6pXd9ODyMleHbh96qaBUoeLrTMXOrrzoUgg8NBow=; b=V53iMwlQUXpBTu49AOmDi5qlJb/qLM7GQXv8YsKWtyonHFjvRevOQn9w5+WfvojCpb JMCaJFUPs1tI111DXxBLdBJgf6nm1n2c9oXOQ2cnaZ6GXQdVZr3ttLlnGP7xFycCsrzw Xze7w7qBVj/L6GLIh8RaKuOTDTcHhAB5U/GkIW+ais4tY7tj/tJp+l8QPFYTk+UXPJCy 7r/JMTAbx4Un/Dlz0OQW5lUve8x6D8ZgEYhm4UnAxSBnxKQlWj+vpASei3zYV3lMt8w8 F3Gh36+xQq02h7VJo/k+t09lqiQVurgdSiRJR7qAYDKVdAn6MJTi2cIUI+W6CUqjb1+e F9Qg== Received: by 10.68.227.67 with SMTP id ry3mr17682419pbc.134.1352382143557; Thu, 08 Nov 2012 05:42:23 -0800 (PST) Received: from localhost ([122.167.75.112]) by mx.google.com with ESMTPS id ug6sm7863042pbc.4.2012.11.08.05.42.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Nov 2012 05:42:23 -0800 (PST) From: Viresh Kumar To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, spear-devel@list.st.com, Deepak Sikri , Viresh Kumar Subject: [PATCH 3/3] input: spear-keyboard: Fix for balancing the enable_irq_wake Date: Thu, 8 Nov 2012 19:10:49 +0530 Message-Id: <367241d1362f7b642e223bb7e7b108bc72df0851.1352381962.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <9f07bb7dbf29978970d901bbe89add0a333cc925.1352381962.git.viresh.kumar@linaro.org> References: <9f07bb7dbf29978970d901bbe89add0a333cc925.1352381962.git.viresh.kumar@linaro.org> In-Reply-To: <9f07bb7dbf29978970d901bbe89add0a333cc925.1352381962.git.viresh.kumar@linaro.org> References: <9f07bb7dbf29978970d901bbe89add0a333cc925.1352381962.git.viresh.kumar@linaro.org> X-Gm-Message-State: ALoCoQn30UN0Qsz+I0r69d0BQlXbEclIWrM4Eh7dzA2l2YifWGFR413Vs+YQw6Y8gvFp4faUQlej Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Deepak Sikri This patch handles the fix for unbalanced irq for the cases when enable_irq_wake fails, and a warning related to same is displayed on the console. The workaround is handled at the driver level. Signed-off-by: Deepak Sikri Signed-off-by: Viresh Kumar --- drivers/input/keyboard/spear-keyboard.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 9792924..b8784df 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -60,6 +60,7 @@ struct spear_kbd { struct clk *clk; unsigned int irq; unsigned int mode; + unsigned int irq_wake; unsigned short last_key; unsigned short keycodes[NUM_ROWS * NUM_COLS]; bool rep; @@ -327,7 +328,8 @@ static int spear_kbd_suspend(struct device *dev) mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG); if (device_may_wakeup(&pdev->dev)) { - enable_irq_wake(kbd->irq); + if (!enable_irq_wake(kbd->irq)) + kbd->irq_wake = 1; /* * reprogram the keyboard operating frequency as on some @@ -373,7 +375,10 @@ static int spear_kbd_resume(struct device *dev) mutex_lock(&input_dev->mutex); if (device_may_wakeup(&pdev->dev)) { - disable_irq_wake(kbd->irq); + if (kbd->irq_wake) { + kbd->irq_wake = 0; + disable_irq_wake(kbd->irq); + } } else { if (input_dev->users) clk_enable(kbd->clk);