lkml.org 
[lkml]   [2006]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch -mm 17/20] chardev: GPIO for SCx200 & PC-8736x: replace spinlocks w mutexes
17/20. patch.mutexes

Replace spinlocks guarding gpio config ops with mutexes. This is a
me-too patch, and is justifiable insofar as mutexes have stricter
semantics and better debugging support, so are preferred where they
are applicable.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>

---

diffstat gpio-scx/patch.mutexes
arch/i386/kernel/scx200.c | 8 ++++----
drivers/char/pc8736x_gpio.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)

diff -ruNp -X dontdiff -X exclude-diffs ax-16/arch/i386/kernel/scx200.c ax-17/arch/i386/kernel/scx200.c
--- ax-16/arch/i386/kernel/scx200.c 2006-06-17 01:36:56.000000000 -0600
+++ ax-17/arch/i386/kernel/scx200.c 2006-06-17 01:51:49.000000000 -0600
@@ -9,6 +9,7 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/mutex.h>
#include <linux/pci.h>

#include <linux/scx200.h>
@@ -45,7 +46,7 @@ static struct pci_driver scx200_pci_driv
.probe = scx200_probe,
};

-static DEFINE_SPINLOCK(scx200_gpio_config_lock);
+DEFINE_MUTEX(scx200_gpio_config_lock);

static void __devinit scx200_init_shadow(void)
{
@@ -95,9 +96,8 @@ static int __devinit scx200_probe(struct
u32 scx200_gpio_configure(unsigned index, u32 mask, u32 bits)
{
u32 config, new_config;
- unsigned long flags;

- spin_lock_irqsave(&scx200_gpio_config_lock, flags);
+ mutex_lock(&scx200_gpio_config_lock);

outl(index, scx200_gpio_base + 0x20);
config = inl(scx200_gpio_base + 0x24);
@@ -105,7 +105,7 @@ u32 scx200_gpio_configure(unsigned index
new_config = (config & mask) | bits;
outl(new_config, scx200_gpio_base + 0x24);

- spin_unlock_irqrestore(&scx200_gpio_config_lock, flags);
+ mutex_unlock(&scx200_gpio_config_lock);

return config;
}
diff -ruNp -X dontdiff -X exclude-diffs ax-16/drivers/char/pc8736x_gpio.c ax-17/drivers/char/pc8736x_gpio.c
--- ax-16/drivers/char/pc8736x_gpio.c 2006-06-17 01:48:50.000000000 -0600
+++ ax-17/drivers/char/pc8736x_gpio.c 2006-06-17 01:51:49.000000000 -0600
@@ -16,6 +16,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/ioport.h>
+#include <linux/mutex.h>
#include <linux/nsc_gpio.h>
#include <linux/platform_device.h>
#include <asm/uaccess.h>
@@ -31,7 +32,7 @@ static int major = 0; /* default to dyn
module_param(major, int, 0);
MODULE_PARM_DESC(major, "Major device number");

-static DEFINE_SPINLOCK(pc8736x_gpio_config_lock);
+DEFINE_MUTEX(pc8736x_gpio_config_lock);
static unsigned pc8736x_gpio_base;
static u8 pc8736x_gpio_shadow[4];

@@ -119,9 +120,8 @@ static inline u32 pc8736x_gpio_configure
u32 func_slct)
{
u32 config, new_config;
- unsigned long flags;

- spin_lock_irqsave(&pc8736x_gpio_config_lock, flags);
+ mutex_lock(&pc8736x_gpio_config_lock);

device_select(SIO_GPIO_UNIT);
select_pin(index);
@@ -133,7 +133,7 @@ static inline u32 pc8736x_gpio_configure
new_config = (config & mask) | bits;
superio_outb(func_slct, new_config);

- spin_unlock_irqrestore(&pc8736x_gpio_config_lock, flags);
+ mutex_unlock(&pc8736x_gpio_config_lock);

return config;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-17 20:40    [W:0.034 / U:7.100 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site