diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-12 13:42:23 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-12 13:42:23 -0500 |
commit | 00431707be0cc1236ee08459367872b57da5be29 (patch) | |
tree | 0a57cbf54f1fcc9ef2852e68e96c3b99e1b903d8 /arch/arm/mach-pxa | |
parent | f4619025a51747a3788fd1bb6bdc46e368a889a7 (diff) |
[ARM] Convert some arm semaphores to mutexes
The arm clock semaphores are strict mutexes, convert them to the new
mutex implementation
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/ssp.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c index a68b30eff4d2..93096befd017 100644 --- a/arch/arm/mach-pxa/ssp.c +++ b/arch/arm/mach-pxa/ssp.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/ioport.h> | 32 | #include <linux/ioport.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/mutex.h> | ||
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
36 | #include <asm/hardware.h> | 37 | #include <asm/hardware.h> |
@@ -59,7 +60,7 @@ static const struct ssp_info_ ssp_info[PXA_SSP_PORTS] = { | |||
59 | #endif | 60 | #endif |
60 | }; | 61 | }; |
61 | 62 | ||
62 | static DECLARE_MUTEX(sem); | 63 | static DEFINE_MUTEX(mutex); |
63 | static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; | 64 | static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; |
64 | 65 | ||
65 | static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 66 | static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
@@ -239,16 +240,16 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) | |||
239 | if (port > PXA_SSP_PORTS || port == 0) | 240 | if (port > PXA_SSP_PORTS || port == 0) |
240 | return -ENODEV; | 241 | return -ENODEV; |
241 | 242 | ||
242 | down(&sem); | 243 | mutex_lock(&mutex); |
243 | if (use_count[port - 1]) { | 244 | if (use_count[port - 1]) { |
244 | up(&sem); | 245 | mutex_unlock(&mutex); |
245 | return -EBUSY; | 246 | return -EBUSY; |
246 | } | 247 | } |
247 | use_count[port - 1]++; | 248 | use_count[port - 1]++; |
248 | 249 | ||
249 | if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { | 250 | if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { |
250 | use_count[port - 1]--; | 251 | use_count[port - 1]--; |
251 | up(&sem); | 252 | mutex_unlock(&mutex); |
252 | return -EBUSY; | 253 | return -EBUSY; |
253 | } | 254 | } |
254 | dev->port = port; | 255 | dev->port = port; |
@@ -265,13 +266,13 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) | |||
265 | 266 | ||
266 | /* turn on SSP port clock */ | 267 | /* turn on SSP port clock */ |
267 | pxa_set_cken(ssp_info[port-1].clock, 1); | 268 | pxa_set_cken(ssp_info[port-1].clock, 1); |
268 | up(&sem); | 269 | mutex_unlock(&mutex); |
269 | return 0; | 270 | return 0; |
270 | 271 | ||
271 | out_region: | 272 | out_region: |
272 | release_mem_region(__PREG(SSCR0_P(port)), 0x2c); | 273 | release_mem_region(__PREG(SSCR0_P(port)), 0x2c); |
273 | use_count[port - 1]--; | 274 | use_count[port - 1]--; |
274 | up(&sem); | 275 | mutex_unlock(&mutex); |
275 | return ret; | 276 | return ret; |
276 | } | 277 | } |
277 | 278 | ||
@@ -282,7 +283,7 @@ out_region: | |||
282 | */ | 283 | */ |
283 | void ssp_exit(struct ssp_dev *dev) | 284 | void ssp_exit(struct ssp_dev *dev) |
284 | { | 285 | { |
285 | down(&sem); | 286 | mutex_lock(&mutex); |
286 | SSCR0_P(dev->port) &= ~SSCR0_SSE; | 287 | SSCR0_P(dev->port) &= ~SSCR0_SSE; |
287 | 288 | ||
288 | if (dev->port > PXA_SSP_PORTS || dev->port == 0) { | 289 | if (dev->port > PXA_SSP_PORTS || dev->port == 0) { |
@@ -295,7 +296,7 @@ void ssp_exit(struct ssp_dev *dev) | |||
295 | free_irq(dev->irq, dev); | 296 | free_irq(dev->irq, dev); |
296 | release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); | 297 | release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); |
297 | use_count[dev->port - 1]--; | 298 | use_count[dev->port - 1]--; |
298 | up(&sem); | 299 | mutex_unlock(&mutex); |
299 | } | 300 | } |
300 | 301 | ||
301 | EXPORT_SYMBOL(ssp_write_word); | 302 | EXPORT_SYMBOL(ssp_write_word); |