All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/27] cbus: tahvo: convert spinlock into mutex
@ 2011-10-13  8:34 Felipe Balbi
  2011-10-13  8:34 ` [PATCH 02/27] cbus: tahvo: move to __devinit/__devexit sections Felipe Balbi
                   ` (26 more replies)
  0 siblings, 27 replies; 31+ messages in thread
From: Felipe Balbi @ 2011-10-13  8:34 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

GPIO operations can sleep, so move to a
mutex.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 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 <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/mutex.h>
 
 #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 */
-- 
1.7.6.396.ge0613


^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2011-10-17 18:26 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-13  8:34 [PATCH 01/27] cbus: tahvo: convert spinlock into mutex Felipe Balbi
2011-10-13  8:34 ` [PATCH 02/27] cbus: tahvo: move to __devinit/__devexit sections Felipe Balbi
2011-10-13  8:34 ` [PATCH 03/27] cbus: tahvo: a switch looks better Felipe Balbi
2011-10-13  8:34 ` [PATCH 04/27] cbus: tahvo: don't go over 80 columns Felipe Balbi
2011-10-13  8:34 ` [PATCH 05/27] cbus: tahvo: drop the tasklet Felipe Balbi
2011-10-13  8:34 ` [PATCH 06/27] cbus: retu: set IRQF_ONESHOT flag Felipe Balbi
2011-10-13  8:34 ` [PATCH 07/27] cbus: tahvo: git it a context structure Felipe Balbi
2011-10-13  8:34 ` [PATCH 08/27] cbus: tahvo: pass tahvo to IRQ handler Felipe Balbi
2011-10-13  8:34 ` [PATCH 09/27] cbus: tahvo: introduce __tahvo_(read/write)_reg Felipe Balbi
2011-10-13  8:34 ` [PATCH 10/27] cbus: tahvo: drop some unneded defines Felipe Balbi
2011-10-13  8:34 ` [PATCH 11/27] cbus: retu: IRQ demux optimization Felipe Balbi
2011-10-13  8:34 ` [PATCH 12/27] cbus: tahvo: give it an irq_chip Felipe Balbi
2011-10-13  8:34 ` [PATCH 13/27] cbus: tahvo: start using irq_chip Felipe Balbi
2011-10-13  8:34 ` [PATCH 14/27] cbus: tahvo: usb: fix up to use threaded irqs Felipe Balbi
2011-10-13  8:34 ` [PATCH 15/27] cbus: tahvo drop the legacy interfaces Felipe Balbi
2011-10-13  8:34 ` [PATCH 16/27] cbus: tahvo: usb: drop unused variable Felipe Balbi
2011-10-13  8:34 ` [PATCH 17/27] cbus: tahvo: no need to mask interrupts on exit Felipe Balbi
2011-10-13  8:34 ` [PATCH 18/27] cbus: tahvo: drop the get_status hack Felipe Balbi
2011-10-13  8:34 ` [PATCH 19/27] cbus: tahvo: drop more unused interfaces Felipe Balbi
2011-10-13  8:34 ` [PATCH 20/27] cbus: tahvo: pass child device pointer Felipe Balbi
2011-10-13  8:34 ` [PATCH 21/27] cbus: tahvo: drop backlight interfaces Felipe Balbi
2011-10-13  8:34 ` [PATCH 22/27] cbus: tahvo: drop static global pointer Felipe Balbi
2011-10-13  8:34 ` [PATCH 23/27] cbus: tahvo: prepare for children without IRQ Felipe Balbi
2011-10-13  8:34 ` [PATCH 24/27] cbus: tahvo: allocate tahvo-pwm child Felipe Balbi
2011-10-13  8:35 ` [PATCH 25/27] cbus: fix compile issue on tahvo and retu Felipe Balbi
2011-10-13  8:35 ` [PATCH 26/27] cbus: use platform_driver_register " Felipe Balbi
2011-10-13  8:35 ` [PATCH 27/27] cbus: mark dependencies for ARCH_OMAP Felipe Balbi
2011-10-17 17:20 ` [PATCH 01/27] cbus: tahvo: convert spinlock into mutex Tony Lindgren
2011-10-17 18:04   ` Felipe Balbi
2011-10-17 18:19     ` Tony Lindgren
2011-10-17 18:26       ` Felipe Balbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.