Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74587
b: refs/heads/master
c: 068f407
h: refs/heads/master
i:
  74585: cfdf51b
  74583: 2ba9f73
v: v3
  • Loading branch information
David Brownell authored and Linus Torvalds committed Dec 5, 2007
1 parent 2af54d5 commit fe16d6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f8fcc93319faa09272185af100fb24e71b02ab03
refs/heads/master: 068f4070868c801c7d7aa1ae1193c1c854193545
6 changes: 3 additions & 3 deletions trunk/drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);

Expand Down

0 comments on commit fe16d6a

Please sign in to comment.