From patchwork Mon Jun 8 04:13:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 28554 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n584E15g008812 for ; Mon, 8 Jun 2009 04:14:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750698AbZFHENj (ORCPT ); Mon, 8 Jun 2009 00:13:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750699AbZFHENj (ORCPT ); Mon, 8 Jun 2009 00:13:39 -0400 Received: from utopia.booyaka.com ([72.9.107.138]:52106 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750698AbZFHENj (ORCPT ); Mon, 8 Jun 2009 00:13:39 -0400 Received: (qmail 27711 invoked by uid 526); 8 Jun 2009 04:13:40 -0000 Date: Sun, 7 Jun 2009 22:13:40 -0600 (MDT) From: Paul Walmsley To: linux-omap@vger.kernel.org Subject: OMAP2+: omap_device: bug fix patch for omap_device_idle()/omap_device_shutdown() Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This patch fixes a crash in the _omap_device_deactivate(). It will be rolled into the next omap_device patch series posting. Signed-off-by: Paul Walmsley --- arch/arm/plat-omap/omap_device.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index a992b88..0c54892 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -127,10 +127,12 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat) pr_debug("omap_device: %s: activating\n", od->pdev.name); - while (od->pm_lat_level >= 0) { + while (od->pm_lat_level > 0) { struct omap_device_pm_latency *odpl; int act_lat = 0; + od->pm_lat_level--; + odpl = od->pm_lats + od->pm_lat_level; if (!ignore_lat && @@ -155,7 +157,6 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat) act_lat, odpl->activate_lat); od->dev_wakeup_lat -= odpl->activate_lat; - od->pm_lat_level--; } return 0; @@ -181,7 +182,7 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat) pr_debug("omap_device: %s: deactivating\n", od->pdev.name); - while (od->pm_lat_level < (od->pm_lats_cnt - 1)) { + while (od->pm_lat_level < od->pm_lats_cnt) { struct omap_device_pm_latency *odpl; int deact_lat = 0; @@ -454,7 +455,7 @@ int omap_device_enable(struct platform_device *pdev) /* Enable everything if we're enabling this device from scratch */ if (od->_state == OMAP_DEVICE_STATE_UNKNOWN) - od->pm_lat_level = od->pm_lats_cnt - 1; + od->pm_lat_level = od->pm_lats_cnt; ret = _omap_device_activate(od, IGNORE_WAKEUP_LAT);