diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-12 18:42:23 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-12 18:42:23 +0000 |
commit | 00431707be0cc1236ee08459367872b57da5be29 (patch) | |
tree | 0a57cbf54f1fcc9ef2852e68e96c3b99e1b903d8 /arch/arm/mach-pxa/ssp.c | |
parent | f4619025a51747a3788fd1bb6bdc46e368a889a7 (diff) | |
download | talos-op-linux-00431707be0cc1236ee08459367872b57da5be29.tar.gz talos-op-linux-00431707be0cc1236ee08459367872b57da5be29.zip |
[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/ssp.c')
-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 @@ #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/init.h> +#include <linux/mutex.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/hardware.h> @@ -59,7 +60,7 @@ static const struct ssp_info_ ssp_info[PXA_SSP_PORTS] = { #endif }; -static DECLARE_MUTEX(sem); +static DEFINE_MUTEX(mutex); static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; 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) if (port > PXA_SSP_PORTS || port == 0) return -ENODEV; - down(&sem); + mutex_lock(&mutex); if (use_count[port - 1]) { - up(&sem); + mutex_unlock(&mutex); return -EBUSY; } use_count[port - 1]++; if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { use_count[port - 1]--; - up(&sem); + mutex_unlock(&mutex); return -EBUSY; } dev->port = port; @@ -265,13 +266,13 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) /* turn on SSP port clock */ pxa_set_cken(ssp_info[port-1].clock, 1); - up(&sem); + mutex_unlock(&mutex); return 0; out_region: release_mem_region(__PREG(SSCR0_P(port)), 0x2c); use_count[port - 1]--; - up(&sem); + mutex_unlock(&mutex); return ret; } @@ -282,7 +283,7 @@ out_region: */ void ssp_exit(struct ssp_dev *dev) { - down(&sem); + mutex_lock(&mutex); SSCR0_P(dev->port) &= ~SSCR0_SSE; if (dev->port > PXA_SSP_PORTS || dev->port == 0) { @@ -295,7 +296,7 @@ void ssp_exit(struct ssp_dev *dev) free_irq(dev->irq, dev); release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); use_count[dev->port - 1]--; - up(&sem); + mutex_unlock(&mutex); } EXPORT_SYMBOL(ssp_write_word); |