From patchwork Mon Mar 9 07:05:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ext-eero.nurkkala@nokia.com X-Patchwork-Id: 10618 X-Patchwork-Delegate: tony@atomide.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 n2979LtJ002289 for ; Mon, 9 Mar 2009 07:09:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752897AbZCIHIr (ORCPT ); Mon, 9 Mar 2009 03:08:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752970AbZCIHIr (ORCPT ); Mon, 9 Mar 2009 03:08:47 -0400 Received: from smtp.nokia.com ([192.100.122.230]:23315 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752897AbZCIHIo (ORCPT ); Mon, 9 Mar 2009 03:08:44 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n2978Tne032037 for ; Mon, 9 Mar 2009 09:08:40 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 9 Mar 2009 09:08:06 +0200 Received: from mgw-int02.ntc.nokia.com ([172.21.143.97]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 9 Mar 2009 09:08:06 +0200 Received: from localhost.localdomain (ouped118146.nmp.nokia.com [172.23.118.146]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n29781rN015299; Mon, 9 Mar 2009 09:08:04 +0200 From: ext-eero.nurkkala@nokia.com To: linux-omap@vger.kernel.org Cc: Eero Nurkkala Subject: [PATCH 2/2] OMAP: McBSP: Do not enable or disable clocks on failed path Date: Mon, 9 Mar 2009 09:05:12 +0200 Message-Id: <1236582316453-git-send-email-ext-eero.nurkkala@nokia.com> X-Mailer: git-send-email 1.5.2 In-Reply-To: <12365823142066-git-send-email-ext-eero.nurkkala@nokia.com> References: <12365823123402-git-send-email-ext-eero.nurkkala@nokia.com> <12365823142066-git-send-email-ext-eero.nurkkala@nokia.com> X-OriginalArrivalTime: 09 Mar 2009 07:08:06.0188 (UTC) FILETIME=[CB7DBEC0:01C9A085] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Eero Nurkkala McBSP clocks are being double enabled in the event the McBSP is already active. Also, they are unnecessarily disabled when there's no active McBSP in use. Fix this phenomenom by enabling and disabling the clocks at a proper location. Signed-off-by: Eero Nurkkala --- arch/arm/plat-omap/mcbsp.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 59850c2..e7755b9 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c @@ -226,9 +226,6 @@ int omap_mcbsp_request(unsigned int id) if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) mcbsp->pdata->ops->request(id); - for (i = 0; i < mcbsp->num_clks; i++) - clk_enable(mcbsp->clks[i]); - spin_lock(&mcbsp->lock); if (!mcbsp->free) { dev_err(mcbsp->dev, "McBSP%d is currently in use\n", @@ -240,6 +237,9 @@ int omap_mcbsp_request(unsigned int id) mcbsp->free = 0; spin_unlock(&mcbsp->lock); + for (i = 0; i < mcbsp->num_clks; i++) + clk_enable(mcbsp->clks[i]); + /* * Enable wakup behavior, smart idle and all wakeups * REVISIT: some wakeups may be unnecessary @@ -319,9 +319,6 @@ void omap_mcbsp_free(unsigned int id) if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) mcbsp->pdata->ops->free(id); - for (i = mcbsp->num_clks - 1; i >= 0; i--) - clk_disable(mcbsp->clks[i]); - spin_lock(&mcbsp->lock); if (mcbsp->free) { dev_err(mcbsp->dev, "McBSP%d was not reserved\n", @@ -333,6 +330,9 @@ void omap_mcbsp_free(unsigned int id) mcbsp->free = 1; spin_unlock(&mcbsp->lock); + for (i = mcbsp->num_clks - 1; i >= 0; i--) + clk_disable(mcbsp->clks[i]); + if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) { /* Free IRQs */ free_irq(mcbsp->rx_irq, (void *)mcbsp);