From: luowei Date: Wed, 9 Oct 2013 03:12:56 +0000 (+0800) Subject: add full duplex interface support X-Git-Tag: firefly_0821_release~6577 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=37ca06ba094a7f8a9c732704633f6909d9178685;p=firefly-linux-kernel-4.4.55.git add full duplex interface support --- diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 70446587e718..fca9e9b494b6 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -619,6 +619,21 @@ 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); +} + /* this copies txbuf and rxbuf data; for small transfers only! */ extern int spi_write_then_read(struct spi_device *spi, const void *txbuf, unsigned n_tx,