From patchwork Thu Aug 19 08:14:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 120318 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7J8BK58012032 for ; Thu, 19 Aug 2010 08:11:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751407Ab0HSILT (ORCPT ); Thu, 19 Aug 2010 04:11:19 -0400 Received: from mail.windriver.com ([147.11.1.11]:39251 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751361Ab0HSILS (ORCPT ); Thu, 19 Aug 2010 04:11:18 -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 o7J8B320028969; Thu, 19 Aug 2010 01:11:03 -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, 19 Aug 2010 01:11:01 -0700 From: Jason Wang To: dmitry.torokhov@gmail.com, dtor@mail.ru, notasas@gmail.com, vapier@gentoo.org Cc: linux-input@vger.kernel.org Subject: [PATCH] Input: ads7846 - move regulator codes out of spinlock protected area Date: Thu, 19 Aug 2010 16:14:30 +0800 Message-Id: <1282205670-30618-1-git-send-email-jason77.wang@gmail.com> X-Mailer: git-send-email 1.5.6.5 X-OriginalArrivalTime: 19 Aug 2010 08:11:02.0260 (UTC) FILETIME=[10509B40:01CB3F76] 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 (demeter.kernel.org [140.211.167.41]); Thu, 19 Aug 2010 08:11:20 +0000 (UTC) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 1603193..9421df9 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -531,6 +531,9 @@ static ssize_t ads7846_disable_store(struct device *dev, if (strict_strtoul(buf, 10, &i)) return -EINVAL; + if (!i) + regulator_enable(ts->reg); + spin_lock_irq(&ts->lock); if (i) @@ -540,6 +543,9 @@ static ssize_t ads7846_disable_store(struct device *dev, spin_unlock_irq(&ts->lock); + if (i) + regulator_disable(ts->reg); + return count; } @@ -855,8 +861,6 @@ static void ads7846_disable(struct ads7846 *ts) } } - regulator_disable(ts->reg); - /* we know the chip's in lowpower mode since we always * leave it that way after every request */ @@ -868,8 +872,6 @@ static void ads7846_enable(struct ads7846 *ts) if (!ts->disabled) return; - regulator_enable(ts->reg); - ts->disabled = 0; ts->irq_disabled = 0; enable_irq(ts->spi->irq); @@ -886,6 +888,8 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message) spin_unlock_irq(&ts->lock); + regulator_disable(ts->reg); + if (device_may_wakeup(&ts->spi->dev)) enable_irq_wake(ts->spi->irq); @@ -900,6 +904,8 @@ static int ads7846_resume(struct spi_device *spi) if (device_may_wakeup(&ts->spi->dev)) disable_irq_wake(ts->spi->irq); + regulator_enable(ts->reg); + spin_lock_irq(&ts->lock); ts->is_suspended = 0;