From patchwork Fri Jul 8 22:52:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 957582 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p68Mqkq8002047 for ; Fri, 8 Jul 2011 22:52:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194Ab1GHWwt (ORCPT ); Fri, 8 Jul 2011 18:52:49 -0400 Received: from na3sys009aog124.obsmtp.com ([74.125.149.151]:55769 "EHLO na3sys009aog124.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752099Ab1GHWwt (ORCPT ); Fri, 8 Jul 2011 18:52:49 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]) (using TLSv1) by na3sys009aob124.postini.com ([74.125.148.12]) with SMTP ID DSNKTheKQE4SC/PWd55MRKW67HxuW3AHuuHq@postini.com; Fri, 08 Jul 2011 15:52:49 PDT Received: by bwd5 with SMTP id 5so3205324bwd.33 for ; Fri, 08 Jul 2011 15:52:47 -0700 (PDT) Received: by 10.204.30.196 with SMTP id v4mr563314bkc.255.1310165566927; Fri, 08 Jul 2011 15:52:46 -0700 (PDT) Received: from localhost (cs181221225.pp.htv.fi [82.181.221.225]) by mx.google.com with ESMTPS id j20sm383522bks.56.2011.07.08.15.52.45 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Jul 2011 15:52:45 -0700 (PDT) From: Felipe Balbi To: Tony Lindgren Cc: Linux OMAP Mailing List , Felipe Balbi Subject: [PATCH 01/11] cbus: tahvo: convert spinlock into mutex Date: Sat, 9 Jul 2011 01:52:29 +0300 Message-Id: <1310165559-31037-2-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1310165559-31037-1-git-send-email-balbi@ti.com> References: <1310165559-31037-1-git-send-email-balbi@ti.com> Organization: Texas Instruments\n Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 08 Jul 2011 22:52:54 +0000 (UTC) GPIO operations can sleep, so move to a mutex. Signed-off-by: Felipe Balbi --- drivers/cbus/tahvo.c | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c index d4a89a6..bc3ca6d 100644 --- a/drivers/cbus/tahvo.c +++ b/drivers/cbus/tahvo.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "cbus.h" #include "tahvo.h" @@ -43,7 +44,7 @@ static int tahvo_initialized; static int tahvo_is_betty; static struct tasklet_struct tahvo_tasklet; -static DEFINE_SPINLOCK(tahvo_lock); +static struct mutex tahvo_lock; static struct device *the_dev; @@ -97,15 +98,14 @@ EXPORT_SYMBOL(tahvo_write_reg); */ void tahvo_set_clear_reg_bits(unsigned reg, u16 set, u16 clear) { - unsigned long flags; u16 w; - spin_lock_irqsave(&tahvo_lock, flags); + mutex_lock(&tahvo_lock); w = tahvo_read_reg(reg); w &= ~clear; w |= set; tahvo_write_reg(reg, w); - spin_unlock_irqrestore(&tahvo_lock, flags); + mutex_unlock(&tahvo_lock); } /* @@ -113,14 +113,13 @@ void tahvo_set_clear_reg_bits(unsigned reg, u16 set, u16 clear) */ void tahvo_disable_irq(int id) { - unsigned long flags; u16 mask; - spin_lock_irqsave(&tahvo_lock, flags); + mutex_lock(&tahvo_lock); mask = tahvo_read_reg(TAHVO_REG_IMR); mask |= 1 << id; tahvo_write_reg(TAHVO_REG_IMR, mask); - spin_unlock_irqrestore(&tahvo_lock, flags); + mutex_unlock(&tahvo_lock); } EXPORT_SYMBOL(tahvo_disable_irq); @@ -129,14 +128,13 @@ EXPORT_SYMBOL(tahvo_disable_irq); */ void tahvo_enable_irq(int id) { - unsigned long flags; u16 mask; - spin_lock_irqsave(&tahvo_lock, flags); + mutex_lock(&tahvo_lock); mask = tahvo_read_reg(TAHVO_REG_IMR); mask &= ~(1 << id); tahvo_write_reg(TAHVO_REG_IMR, mask); - spin_unlock_irqrestore(&tahvo_lock, flags); + mutex_unlock(&tahvo_lock); } EXPORT_SYMBOL(tahvo_enable_irq); @@ -297,6 +295,7 @@ static int __init tahvo_probe(struct platform_device *pdev) int rev, id, ret; int irq; + mutex_init(&tahvo_lock); the_dev = &pdev->dev; /* Prepare tasklet */