Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74589
b: refs/heads/master
c: 9b938b7
h: refs/heads/master
i:
  74587: fe16d6a
v: v3
  • Loading branch information
Marc Pignat authored and Linus Torvalds committed Dec 5, 2007
1 parent df4af35 commit 5c34eee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 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: 3f86f14c0fc9fdb0984e64209df2f47895a07151
refs/heads/master: 9b938b749065d6a94172ac24d9748bd66a03da4c
13 changes: 5 additions & 8 deletions trunk/drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,7 @@ static void spi_complete(void *arg)
* Also, the caller is guaranteeing that the memory associated with the
* message will not be freed before this call returns.
*
* The return value is a negative error code if the message could not be
* submitted, else zero. When the value is zero, then message->status is
* also defined; it's the completion code for the transfer, either zero
* or a negative error code from the controller driver.
* It returns zero on success, else a negative error code.
*/
int spi_sync(struct spi_device *spi, struct spi_message *message)
{
Expand All @@ -554,8 +551,10 @@ int spi_sync(struct spi_device *spi, struct spi_message *message)
message->complete = spi_complete;
message->context = &done;
status = spi_async(spi, message);
if (status == 0)
if (status == 0) {
wait_for_completion(&done);
status = message->status;
}
message->context = NULL;
return status;
}
Expand Down Expand Up @@ -628,10 +627,8 @@ int spi_write_then_read(struct spi_device *spi,

/* do the i/o */
status = spi_sync(spi, &message);
if (status == 0) {
if (status == 0)
memcpy(rxbuf, x[1].rx_buf, n_rx);
status = message.status;
}

if (x[0].tx_buf == buf)
mutex_unlock(&lock);
Expand Down

0 comments on commit 5c34eee

Please sign in to comment.