From patchwork Tue Dec 28 17:14:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 436851 X-Patchwork-Delegate: me@felipebalbi.com 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 oBSHHis1005756 for ; Tue, 28 Dec 2010 17:17:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754218Ab0L1RRL (ORCPT ); Tue, 28 Dec 2010 12:17:11 -0500 Received: from na3sys009aog113.obsmtp.com ([74.125.149.209]:42228 "EHLO na3sys009aog113.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754203Ab0L1RRC (ORCPT ); Tue, 28 Dec 2010 12:17:02 -0500 Received: from source ([209.85.215.175]) (using TLSv1) by na3sys009aob113.postini.com ([74.125.148.12]) with SMTP ID DSNKTRobjWz5wd/nz1FQSLzqXinz7b/k7twf@postini.com; Tue, 28 Dec 2010 09:17:02 PST Received: by mail-ey0-f175.google.com with SMTP id 28so4616075eya.6 for ; Tue, 28 Dec 2010 09:17:00 -0800 (PST) Received: by 10.213.28.66 with SMTP id l2mr12169307ebc.71.1293556620774; Tue, 28 Dec 2010 09:17:00 -0800 (PST) Received: from localhost (cs181221087.pp.htv.fi [82.181.221.87]) by mx.google.com with ESMTPS id t5sm9859977eeh.8.2010.12.28.09.16.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Dec 2010 09:17:00 -0800 (PST) From: Felipe Balbi To: Linux Kernel Mailing List , Linux OMAP Mailing List Cc: Tony Lindgren , David Brownell , Thomas Gleixner , Mark Brown , Felipe Balbi Subject: [RFC/PATCH 3/3] mfd: twl4030-irq: implement bus_*lock Date: Tue, 28 Dec 2010 19:14:19 +0200 Message-Id: <1293556459-28613-4-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.7.3.4.598.g85356 In-Reply-To: <1293556459-28613-1-git-send-email-balbi@ti.com> References: <20101228161657.GF2239@legolas.emea.dhcp.ti.com> <1293556459-28613-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.3 (demeter1.kernel.org [140.211.167.41]); Tue, 28 Dec 2010 17:17:45 +0000 (UTC) diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index 298956d..ff7bb93 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c @@ -461,8 +461,6 @@ static void twl4030_sih_mask(unsigned irq) agent->imr |= BIT(irq - agent->irq_base); - mutex_lock(&agent->irq_lock); - /* byte[0] gets overwritten as we write ... */ imr.word = cpu_to_le32(agent->imr << 8); @@ -472,7 +470,6 @@ static void twl4030_sih_mask(unsigned irq) if (status) pr_err("twl4030: %s, %s --> %d\n", __func__, "write", status); - mutex_unlock(&agent->irq_lock); } static void twl4030_sih_unmask(unsigned irq) @@ -487,7 +484,6 @@ static void twl4030_sih_unmask(unsigned irq) int status; - mutex_lock(&agent->irq_lock); agent->imr &= ~BIT(irq - agent->irq_base); /* byte[0] gets overwritten as we write ... */ @@ -499,7 +495,6 @@ static void twl4030_sih_unmask(unsigned irq) if (status) pr_err("twl4030: %s, %s --> %d\n", __func__, "write", status); - mutex_unlock(&agent->irq_lock); } static int twl4030_sih_set_type(unsigned irq, unsigned trigger) @@ -517,7 +512,6 @@ static int twl4030_sih_set_type(unsigned irq, unsigned trigger) if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) return -EINVAL; - mutex_lock(&agent->irq_lock); if ((desc->status & IRQ_TYPE_SENSE_MASK) != trigger) { u8 bytes[6]; u32 edge_change; @@ -537,7 +531,7 @@ static int twl4030_sih_set_type(unsigned irq, unsigned trigger) if (status) { pr_err("twl4030: %s, %s --> %d\n", __func__, "read", status); - goto out; + return status; } /* Modify only the bits we know must change */ @@ -550,8 +544,7 @@ static int twl4030_sih_set_type(unsigned irq, unsigned trigger) if (!d) { pr_err("twl4030: Invalid IRQ: %d\n", i + agent->irq_base); - status = -ENODEV; - goto out; + return -ENODEV; } bytes[byte] &= ~(0x03 << off); @@ -574,17 +567,30 @@ static int twl4030_sih_set_type(unsigned irq, unsigned trigger) "write", status); } -out: - mutex_unlock(&agent->irq_lock); - return status; } +static void twl4030_sih_bus_lock(unsigned int irq) +{ + struct sih_agent *agent = get_irq_chip_data(irq); + + mutex_lock(&agent->irq_lock); +} + +static void twl4030_sih_bus_sync_unlock(unsigned int irq) +{ + struct sih_agent *agent = get_irq_chip_data(irq); + + mutex_unlock(&agent->irq_lock); +} + static struct irq_chip twl4030_sih_irq_chip = { .name = "twl4030", .mask = twl4030_sih_mask, .unmask = twl4030_sih_unmask, .set_type = twl4030_sih_set_type, + .bus_lock = twl4030_sih_bus_lock, + .bus_sync_unlock = twl4030_sih_bus_sync_unlock, }; /*----------------------------------------------------------------------*/