projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b5b30b2
)
add spi_write_and_read interface for spi
author
luowei
<lw@rock-chips.com>
Fri, 7 Mar 2014 11:06:04 +0000
(19:06 +0800)
committer
luowei
<lw@rock-chips.com>
Fri, 7 Mar 2014 11:06:04 +0000
(19:06 +0800)
include/linux/spi/spi.h
[changed mode: 0644->0755]
patch
|
blob
|
history
diff --git
a/include/linux/spi/spi.h
b/include/linux/spi/spi.h
old mode 100644
(file)
new mode 100755
(executable)
index
6ff26c8
..
28c101b
--- a/
include/linux/spi/spi.h
+++ b/
include/linux/spi/spi.h
@@
-716,6
+716,23
@@
spi_read(struct spi_device *spi, void *buf, size_t len)
return spi_sync(spi, &m);
}
+
+static inline int
+spi_write_and_read(struct spi_device *spi, const void *tx_buf, void *rx_buf, size_t len)
+{
+ struct spi_transfer t = {
+ .tx_buf = tx_buf,
+ .rx_buf = rx_buf,
+ .len = len,
+ };
+ struct spi_message m;
+
+ spi_message_init(&m);
+ spi_message_add_tail(&t, &m);
+ return spi_sync(spi, &m);
+}
+
+
/**
* spi_sync_transfer - synchronous SPI data transfer
* @spi: device with which data will be exchanged