From patchwork Thu Sep 16 10:51:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 185262 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8GAmL3Z019026 for ; Thu, 16 Sep 2010 10:48:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754361Ab0IPKsD (ORCPT ); Thu, 16 Sep 2010 06:48:03 -0400 Received: from mail.windriver.com ([147.11.1.11]:38255 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754338Ab0IPKsB (ORCPT ); Thu, 16 Sep 2010 06:48:01 -0400 Received: from ALA-MAIL03.corp.ad.wrs.com (ala-mail03 [147.11.57.144]) by mail.windriver.com (8.14.3/8.14.3) with ESMTP id o8GAlwmp022620; Thu, 16 Sep 2010 03:47:58 -0700 (PDT) Received: from localhost.localdomain ([128.224.163.220]) by ALA-MAIL03.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 16 Sep 2010 03:47:57 -0700 From: Jason Wang To: dmitry.torokhov@gmail.com, notasas@gmail.com, vapier@gentoo.org Cc: linux-input@vger.kernel.org Subject: [PATCH 4/4] Input: ads7846 - modificatons of _stop()/_disable() conditions Date: Thu, 16 Sep 2010 18:51:26 +0800 Message-Id: <1284634286-8871-5-git-send-email-jason77.wang@gmail.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1284634286-8871-4-git-send-email-jason77.wang@gmail.com> References: <1284634286-8871-1-git-send-email-jason77.wang@gmail.com> <1284634286-8871-2-git-send-email-jason77.wang@gmail.com> <1284634286-8871-3-git-send-email-jason77.wang@gmail.com> <1284634286-8871-4-git-send-email-jason77.wang@gmail.com> X-OriginalArrivalTime: 16 Sep 2010 10:47:57.0944 (UTC) FILETIME=[A010F780:01CB558C] Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 16 Sep 2010 10:48:23 +0000 (UTC) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index eab8b0b..349031d 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -198,7 +198,7 @@ struct ads7846 { /* Must be called with ts->lock held */ static void ads7846_stop(struct ads7846 *ts) { - if (!ts->disabled && !ts->suspended) { + if (!ts->stopped) { /* Signal IRQ thread to stop polling and disable the handler. */ ts->stopped = true; mb(); @@ -210,7 +210,7 @@ static void ads7846_stop(struct ads7846 *ts) /* Must be called with ts->lock held */ static void ads7846_restart(struct ads7846 *ts) { - if (!ts->disabled && !ts->suspended) { + if (ts->stopped) { /* Tell IRQ thread that it may poll the device. */ ts->stopped = false; mb(); @@ -223,7 +223,7 @@ static void __ads7846_disable(struct ads7846 *ts) { ads7846_stop(ts); regulator_disable(ts->reg); - + ts->disabled = true; /* * We know the chip's in low power mode since we always * leave it that way after every request @@ -235,6 +235,7 @@ static void __ads7846_enable(struct ads7846 *ts) { regulator_enable(ts->reg); ads7846_restart(ts); + ts->disabled = false; } static void ads7846_disable(struct ads7846 *ts) @@ -244,8 +245,6 @@ static void ads7846_disable(struct ads7846 *ts) if (!ts->disabled && !ts->suspended) __ads7846_disable(ts); - ts->disabled = true; - mutex_unlock(&ts->lock); } @@ -256,8 +255,6 @@ static void ads7846_enable(struct ads7846 *ts) if (ts->disabled && !ts->suspended) __ads7846_enable(ts); - ts->disabled = false; - mutex_unlock(&ts->lock); } @@ -919,7 +916,7 @@ static int ads7846_resume(struct spi_device *spi) if (device_may_wakeup(&ts->spi->dev)) disable_irq_wake(ts->spi->irq); - if (!ts->disabled) + if (ts->disabled) __ads7846_enable(ts); ts->suspended = false;