diff options
author | David Brownell <david-b@pacbell.net> | 2007-12-05 08:45:09 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-12-05 18:21:18 +0100 |
commit | 068f4070868c801c7d7aa1ae1193c1c854193545 (patch) | |
tree | 17167c675c5115653e3f28f8977bdfd43b22ce6a /drivers/spi/spi.c | |
parent | Add EXPORT_SYMBOL(ksize); (diff) | |
download | linux-068f4070868c801c7d7aa1ae1193c1c854193545.tar.xz linux-068f4070868c801c7d7aa1ae1193c1c854193545.zip |
SPI: use mutex not semaphore
Make spi_write_then_read() use a mutex not a binary semaphore.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/spi/spi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b31f4431849b..6ca07c9929e6 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -589,7 +589,7 @@ int spi_write_then_read(struct spi_device *spi, const u8 *txbuf, unsigned n_tx, u8 *rxbuf, unsigned n_rx) { - static DECLARE_MUTEX(lock); + static DEFINE_MUTEX(lock); int status; struct spi_message message; @@ -615,7 +615,7 @@ int spi_write_then_read(struct spi_device *spi, } /* ... unless someone else is using the pre-allocated buffer */ - if (down_trylock(&lock)) { + if (!mutex_trylock(&lock)) { local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL); if (!local_buf) return -ENOMEM; @@ -634,7 +634,7 @@ int spi_write_then_read(struct spi_device *spi, } if (x[0].tx_buf == buf) - up(&lock); + mutex_unlock(&lock); else kfree(local_buf); |