Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=068f4070868c801c7d7aa1ae1193c1c854193545
Commit:     068f4070868c801c7d7aa1ae1193c1c854193545
Parent:     f8fcc93319faa09272185af100fb24e71b02ab03
Author:     David Brownell <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 4 23:45:09 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Dec 5 09:21:18 2007 -0800

    SPI: use mutex not semaphore
    
    Make spi_write_then_read() use a mutex not a binary semaphore.
    
    Signed-off-by: David Brownell <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 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 b31f443..6ca07c9 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);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to