diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2006-06-27 05:54:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:43 -0400 |
commit | 8bcf6135c3e8cdfab375f4041a48721483519eee (patch) | |
tree | 06658c8beb4a8e0e3808ca962fced3166a0eb22b | |
parent | 6cad56fd884b7eb85ae193c94b688fe76680fcbf (diff) |
[PATCH] chardev: GPIO for SCx200 & PC-8736x: replace spinlocks w 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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/i386/kernel/scx200.c | 8 | ||||
-rw-r--r-- | drivers/char/pc8736x_gpio.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c index edead73ebef2..9bf590cefc7d 100644 --- a/arch/i386/kernel/scx200.c +++ b/arch/i386/kernel/scx200.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/mutex.h> | ||
12 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
13 | 14 | ||
14 | #include <linux/scx200.h> | 15 | #include <linux/scx200.h> |
@@ -45,7 +46,7 @@ static struct pci_driver scx200_pci_driver = { | |||
45 | .probe = scx200_probe, | 46 | .probe = scx200_probe, |
46 | }; | 47 | }; |
47 | 48 | ||
48 | static DEFINE_SPINLOCK(scx200_gpio_config_lock); | 49 | static DEFINE_MUTEX(scx200_gpio_config_lock); |
49 | 50 | ||
50 | static void __devinit scx200_init_shadow(void) | 51 | static void __devinit scx200_init_shadow(void) |
51 | { | 52 | { |
@@ -95,9 +96,8 @@ static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_ | |||
95 | u32 scx200_gpio_configure(unsigned index, u32 mask, u32 bits) | 96 | u32 scx200_gpio_configure(unsigned index, u32 mask, u32 bits) |
96 | { | 97 | { |
97 | u32 config, new_config; | 98 | u32 config, new_config; |
98 | unsigned long flags; | ||
99 | 99 | ||
100 | spin_lock_irqsave(&scx200_gpio_config_lock, flags); | 100 | mutex_lock(&scx200_gpio_config_lock); |
101 | 101 | ||
102 | outl(index, scx200_gpio_base + 0x20); | 102 | outl(index, scx200_gpio_base + 0x20); |
103 | config = inl(scx200_gpio_base + 0x24); | 103 | config = inl(scx200_gpio_base + 0x24); |
@@ -105,7 +105,7 @@ u32 scx200_gpio_configure(unsigned index, u32 mask, u32 bits) | |||
105 | new_config = (config & mask) | bits; | 105 | new_config = (config & mask) | bits; |
106 | outl(new_config, scx200_gpio_base + 0x24); | 106 | outl(new_config, scx200_gpio_base + 0x24); |
107 | 107 | ||
108 | spin_unlock_irqrestore(&scx200_gpio_config_lock, flags); | 108 | mutex_unlock(&scx200_gpio_config_lock); |
109 | 109 | ||
110 | return config; | 110 | return config; |
111 | } | 111 | } |
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c index b8183d508332..72dcf222f141 100644 --- a/drivers/char/pc8736x_gpio.c +++ b/drivers/char/pc8736x_gpio.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
19 | #include <linux/mutex.h> | ||
19 | #include <linux/nsc_gpio.h> | 20 | #include <linux/nsc_gpio.h> |
20 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
@@ -31,7 +32,7 @@ static int major; /* default to dynamic major */ | |||
31 | module_param(major, int, 0); | 32 | module_param(major, int, 0); |
32 | MODULE_PARM_DESC(major, "Major device number"); | 33 | MODULE_PARM_DESC(major, "Major device number"); |
33 | 34 | ||
34 | static DEFINE_SPINLOCK(pc8736x_gpio_config_lock); | 35 | static DEFINE_MUTEX(pc8736x_gpio_config_lock); |
35 | static unsigned pc8736x_gpio_base; | 36 | static unsigned pc8736x_gpio_base; |
36 | static u8 pc8736x_gpio_shadow[4]; | 37 | static u8 pc8736x_gpio_shadow[4]; |
37 | 38 | ||
@@ -119,9 +120,8 @@ static inline u32 pc8736x_gpio_configure_fn(unsigned index, u32 mask, u32 bits, | |||
119 | u32 func_slct) | 120 | u32 func_slct) |
120 | { | 121 | { |
121 | u32 config, new_config; | 122 | u32 config, new_config; |
122 | unsigned long flags; | ||
123 | 123 | ||
124 | spin_lock_irqsave(&pc8736x_gpio_config_lock, flags); | 124 | mutex_lock(&pc8736x_gpio_config_lock); |
125 | 125 | ||
126 | device_select(SIO_GPIO_UNIT); | 126 | device_select(SIO_GPIO_UNIT); |
127 | select_pin(index); | 127 | select_pin(index); |
@@ -133,7 +133,7 @@ static inline u32 pc8736x_gpio_configure_fn(unsigned index, u32 mask, u32 bits, | |||
133 | new_config = (config & mask) | bits; | 133 | new_config = (config & mask) | bits; |
134 | superio_outb(func_slct, new_config); | 134 | superio_outb(func_slct, new_config); |
135 | 135 | ||
136 | spin_unlock_irqrestore(&pc8736x_gpio_config_lock, flags); | 136 | mutex_unlock(&pc8736x_gpio_config_lock); |
137 | 137 | ||
138 | return config; | 138 | return config; |
139 | } | 139 | } |